forked from dividab/tsconfig-paths
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change testing framework to Jest (dividab#186)
* Upgrade to jest * Fix tests * Remove llog * Test not working * Add explicit extensions (came from running mocha under ts-node) * All pass * Coverage
- Loading branch information
1 parent
cef69d6
commit 9de71eb
Showing
21 changed files
with
2,336 additions
and
1,139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
__tests__/ | ||
__stories__/ | ||
*.test.{js,ts,tsx} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testMatch: ["<rootDir>/src/**/*.test.{ts,tsx}"], | ||
collectCoverage: false, | ||
coverageDirectory: "<rootDir>/coverage/", | ||
collectCoverageFrom: ["<rootDir>/src/**/*.{ts,tsx}"], | ||
coveragePathIgnorePatterns: ["/__tests__/"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import * as Filesystem from "../filesystem"; | ||
import * as path from "path"; | ||
|
||
describe("filesystem", () => { | ||
const fileThatExists = path.join(__dirname, "../../package.json"); | ||
const fileThatNotExists = path.join(__dirname, "../../package2.json"); | ||
|
||
it("should find file that exists, sync", () => { | ||
const result = Filesystem.fileExistsSync(fileThatExists); | ||
// assert.equal(result, true); | ||
expect(result).toBe(true); | ||
}); | ||
|
||
it("should not find file that not exists, sync", () => { | ||
const result = Filesystem.fileExistsSync(fileThatNotExists); | ||
// assert.equal(result, false); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it("should find file that exists, async", (done) => { | ||
Filesystem.fileExistsAsync(fileThatExists, (_err, result) => { | ||
try { | ||
// assert.equal(result, true); | ||
expect(result).toBe(true); | ||
done(); | ||
} catch (error) { | ||
done(error); | ||
} | ||
}); | ||
}); | ||
|
||
it("should not find file that not exists, async", (done) => { | ||
Filesystem.fileExistsAsync(fileThatNotExists, (_err, result) => { | ||
try { | ||
// assert.equal(result, false); | ||
expect(result).toBe(false); | ||
done(); | ||
} catch (error) { | ||
done(error); | ||
} | ||
}); | ||
}); | ||
|
||
it("should load json, sync", () => { | ||
const result = Filesystem.readJsonFromDiskSync(fileThatExists); | ||
// assert.isOk(result); | ||
expect(result); | ||
// assert.equal(result.main, "lib/index.js"); | ||
expect(result.main).toBe("lib/index.js"); | ||
}); | ||
|
||
it("should load json, async", (done) => { | ||
Filesystem.readJsonFromDiskAsync(fileThatExists, (_err, result) => { | ||
try { | ||
// assert.isOk(result); // Asserts that object is truthy. | ||
expect(result).toBeTruthy(); | ||
// assert.equal(result.main, "lib/index.js"); | ||
expect(result.main).toBe("lib/index.js"); | ||
done(); | ||
} catch (error) { | ||
done(error); | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.