File tree Expand file tree Collapse file tree 4 files changed +37
-15
lines changed Expand file tree Collapse file tree 4 files changed +37
-15
lines changed Original file line number Diff line number Diff line change 11const path = require ( "path" ) ;
2- const ncConfig = require ( path . join ( process . cwd ( ) , ".nc.config" ) ) ;
2+ const fs = require ( "fs" ) ;
33const validProviders = require ( "./providers-list" ) ;
4+ const ncConfig = require ( getConfigFilePath ( ) ) ;
5+
6+ function getConfigFilePath ( ) {
7+ const triables = process . cwd ( ) . split ( "\\" ) . length ;
8+ const dirs = process . cwd ( ) . split ( "\\" ) ;
9+ let configFilePath ;
10+
11+ for ( let i = 0 ; i < triables ; i ++ ) {
12+ configFilePath = path . join ( dirs . join ( "\\" ) , ".nc.config.js" ) ;
13+ if ( fs . existsSync ( configFilePath ) ) {
14+ return configFilePath ;
15+ }
16+ dirs . splice ( - 1 , 1 ) ;
17+ configFilePath = null ;
18+ }
19+
20+ if ( ! configFilePath ) {
21+ throw new Error (
22+ "Provider config file not found. Please create a config file in project root."
23+ ) ;
24+ }
25+ }
426
527class Provider {
628 /**
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ const providersList = require ( "../../core/providers-list" ) ;
2+ const { assert } = require ( "chai" ) ;
3+
4+ describe ( "providers list" , function ( ) {
5+ context ( "with array of provider names" , function ( ) {
6+ it ( "should have at least one provider" , function ( ) {
7+ assert ( providersList . length !== 0 ) ;
8+ } ) ;
9+ it ( "should have string literals" , function ( ) {
10+ providersList . forEach ( provider => assert . isString ( provider ) ) ;
11+ } ) ;
12+ } ) ;
13+ } ) ;
Original file line number Diff line number Diff line change 11const chai = require ( "chai" ) ;
22const assert = chai . assert ;
3- const providers = require ( "../core/providers" ) ;
3+ const providers = require ( "../../ core/providers" ) ;
44
55describe ( "Providers list" , ( ) => {
66 it ( "should check for providers" , done => {
You can’t perform that action at this time.
0 commit comments