-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: run jest tests on compiled sources (#200)
- Loading branch information
Showing
14 changed files
with
1,145 additions
and
284 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
build | ||
dist | ||
node_modules | ||
.DS_Store | ||
|
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 @@ | ||
{ | ||
"presets": ["@babel/preset-env"] | ||
} |
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,27 @@ | ||
import path from "path"; | ||
|
||
// Because jest snapshot tests run in the build directory, we need to map | ||
// the saved snapshot location back to the source tree. | ||
export function resolveSnapshotPath(testPath, snapshotExtension) { | ||
const pathInSourceTree = path.relative("build", testPath); | ||
const dirname = path.dirname(pathInSourceTree); | ||
return path.join( | ||
dirname, | ||
"__snapshots__", | ||
path.basename(pathInSourceTree).replace(".js", ".ts.snap") | ||
); | ||
} | ||
|
||
export function resolveTestPath(snapshotFilePath, snapshotExtension) { | ||
return path | ||
.join("build", snapshotFilePath.replace("__snapshots__", "")) | ||
.replace(".ts.snap", ".js"); | ||
} | ||
|
||
export const testPathForConsistencyCheck = "e2e/e2e.spec.js"; | ||
|
||
export default { | ||
resolveSnapshotPath, | ||
resolveTestPath, | ||
testPathForConsistencyCheck, | ||
}; |
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,26 @@ | ||
/* | ||
* For a detailed explanation regarding each configuration property and type check, visit: | ||
* https://jestjs.io/docs/configuration | ||
*/ | ||
|
||
export default { | ||
// Automatically clear mock calls, instances, contexts and results before every test | ||
clearMocks: true, | ||
|
||
// The root directory that Jest should scan for tests and modules within. | ||
rootDir: "build", | ||
|
||
// A list of paths to directories that Jest should use to search for files in. | ||
roots: ["src", "e2e"], | ||
|
||
// A list of paths to modules that run some code to configure or set up the testing framework before each test | ||
setupFilesAfterEnv: ["./jest.setup.js"], | ||
|
||
// The path to a module that can resolve test<->snapshot path. | ||
snapshotResolver: "./jest-snapshot-resolver.js", | ||
|
||
// A map from regular expressions to paths to transformers | ||
transform: { | ||
"\\.js$": "babel-jest", | ||
}, | ||
}; |
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
Oops, something went wrong.