diff --git a/jest.config.js b/jest.config.js index e358725c8..206784f39 100644 --- a/jest.config.js +++ b/jest.config.js @@ -142,12 +142,10 @@ module.exports = { // testLocationInResults: false, // The glob patterns Jest uses to detect test files - testMatch: ['**/*spec.[j|t]s?(x)'], + testMatch: ['./src/**/*spec.[j|t]s?(x)'], // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - // testPathIgnorePatterns: [ - // "/node_modules/" - // ], + testPathIgnorePatterns: ['/node_modules/', '/build'], // The regexp pattern or array of patterns that Jest uses to detect test files // testRegex: [], diff --git a/jest.server.config.js b/jest.server.config.js index ad08108b3..a0f98b572 100644 --- a/jest.server.config.js +++ b/jest.server.config.js @@ -2,7 +2,7 @@ // https://jestjs.io/docs/en/configuration.html module.exports = { - testTimeout: 120000, + testTimeout: 240000, // All imported modules in your tests should be mocked automatically // automock: false, @@ -145,9 +145,7 @@ module.exports = { testMatch: ['**/*spec.server.[j|t]s?(x)'], // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - // testPathIgnorePatterns: [ - // "/node_modules/" - // ], + testPathIgnorePatterns: ['/node_modules/', '/build'], // The regexp pattern or array of patterns that Jest uses to detect test files // testRegex: [], diff --git a/src/cli.ts b/src/cli.ts index 2b7c6d9e2..0d1d201cf 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -51,6 +51,8 @@ export async function cli(args: string[]) { return } break + default: + process.projectDir = process.cwd() } switch (parsedCommand.name) { @@ -142,7 +144,11 @@ function handleInvalidCommand() { export async function checkAndSetProjectDirectory() { const projectDir = process.projectDir - if (!projectDir || projectDir.trim() === 'null') { + if ( + !projectDir || + projectDir.trim() === 'null' || + projectDir.trim() === 'undefined' + ) { process.projectDir = process.cwd() } const buildSourceFolder = path.join(process.projectDir, 'sasjs') diff --git a/src/utils/utils.spec.js b/src/utils/utils.spec.ts similarity index 93% rename from src/utils/utils.spec.js rename to src/utils/utils.spec.ts index 96dcf8ad8..f2a19cbc6 100644 --- a/src/utils/utils.spec.js +++ b/src/utils/utils.spec.ts @@ -6,19 +6,19 @@ import { describe('utils', () => { describe('generateTimestamp', () => { - let realDate + let realDate: DateConstructor beforeAll(() => { const currentDate = new Date('2020-10-02T10:10:10.10Z') realDate = Date - global.Date = class extends Date { - constructor(date) { + global.Date = class extends DateConstructor { + constructor(date: string) { if (date) { return super(date) } return currentDate } - } + } as DateConstructor }) test('should generate a timestamp in the correct format', () => {