e3c6  
                
                  
                    August 30, 2018, 12:41pm
                   
                  1 
               
             
            
              To add a dependency ony for testing, I followed the instructions here: Pkg · The Julia Language .
But this involves editing Project.toml directly. Can this be done through the REPL (like pkg> add ... does for a proper dependency)?
Related (for Julia pre-0.7): Dependency only for testing 
             
            
              1 Like 
            
            
           
          
            
            
              AFAIK you still need to edit the Project.toml.
A convenient way to do this is to pkg> add TheDependency, then open the editor and just move the line and to [extras] and add it to the relevant line in [targets].
             
            
              8 Likes 
            
            
           
          
            
              
                e3c6  
              
                  
                    August 30, 2018,  1:15pm
                   
                  3 
               
             
            
              
This is what I am doing now. Thanks. I see you already opened an issue to request this:
  
  
    
  
  
    
    
      
        opened 08:43AM - 09 Jul 18 UTC 
      
      
     
    
        
          REPL
         
        
          sandbox
         
        
          feature
         
    
   
 
  
    It would be great to have the functionality of #340 exposed in the interactive i… nterface, so that one does not have to manually edit the `Project.toml`. Eg something like
```julia
pkg> add targets.test SomePackage
pkg> rm targets.test SomePackage
```
or simply `add test`. 
   
   
  
    
    
  
  
 
             
            
              
            
           
          
            
            
              Hello,
How should we add a test-only package dependency from the REPL, without copy-pasting from the Project.toml?
             
            
              3 Likes