generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refactor case10 and case10a tests so they don't have duplicate o…
…utputs (#276)
- Loading branch information
1 parent
a196f3e
commit 9b6a225
Showing
14 changed files
with
107 additions
and
50 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 |
---|---|---|
|
@@ -2,5 +2,5 @@ configure: | |
languages: | ||
javascript: true | ||
go: true | ||
kotlin: true | ||
kotlin: false | ||
protobuf: true |
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
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,32 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_library") | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
load("//jest:defs.bzl", "jest_test") | ||
|
||
# Case 10: A js_library() config specifying test-time dependencies | ||
jest_test( | ||
name = "test", | ||
config = ":case10-config", | ||
data = [ | ||
"case10.test.js", | ||
], | ||
node_modules = "//:node_modules", | ||
snapshots = True, | ||
) | ||
|
||
js_library( | ||
name = "case10-config", | ||
srcs = [ | ||
"case10.jest.config.js", | ||
], | ||
data = [ | ||
"case10.config-init.js", | ||
"case10.setup.js", | ||
"//jest/tests:node_modules/@aspect-test/c", | ||
], | ||
) | ||
|
||
# TEST: Ensure the :test_update_snapshots target exists and builds successfully | ||
build_test( | ||
name = "cupdate_snapshots_build", | ||
targets = [":test_update_snapshots"], | ||
) |
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,33 @@ | ||
load("@aspect_rules_js//js:defs.bzl", "js_library") | ||
load("@bazel_skylib//rules:build_test.bzl", "build_test") | ||
load("//jest:defs.bzl", "jest_test") | ||
|
||
# Case 10a: case10 with the chdir param to try a different cwd | ||
jest_test( | ||
name = "test", | ||
chdir = package_name(), | ||
config = ":case10a-config", | ||
data = [ | ||
"case10a.test.js", | ||
], | ||
node_modules = "//:node_modules", | ||
snapshots = True, | ||
) | ||
|
||
js_library( | ||
name = "case10a-config", | ||
srcs = [ | ||
"case10a.jest.config.js", | ||
], | ||
data = [ | ||
"case10a.config-init.js", | ||
"case10a.setup.js", | ||
"//jest/tests:node_modules/@aspect-test/c", | ||
], | ||
) | ||
|
||
# TEST: Ensure the :test_update_snapshots target exists and builds successfully | ||
build_test( | ||
name = "update_snapshots_build", | ||
targets = [":test_update_snapshots"], | ||
) |
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,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`the config + setup files run 1`] = `42`; | ||
|
||
exports[`the config + setup files run 2`] = `true`; | ||
|
||
exports[`the config + setup files run 3`] = `true`; |
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 @@ | ||
global.TEST_CONFIG_INIT_VALUE = true; |
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,12 @@ | ||
const path = require("path"); | ||
|
||
// A config-time file dep | ||
require("./case10a.config-init"); | ||
|
||
// A config-time npm dep and config-time value to verify | ||
global.TEST_CONFIG_VALUE = typeof require("@aspect-test/c").id === "function"; | ||
|
||
module.exports = { | ||
// A runtime setup dep | ||
setupFiles: [path.join(__dirname, "case10a.setup.js")], | ||
}; |
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 @@ | ||
global.TEST_SETUP_VALUE = 42; |
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 @@ | ||
test("the config + setup files run", () => { | ||
expect(TEST_SETUP_VALUE).toEqual(42); | ||
expect(TEST_SETUP_VALUE).toMatchSnapshot(); | ||
|
||
expect(TEST_CONFIG_VALUE).toBe(true); | ||
expect(TEST_CONFIG_VALUE).toMatchSnapshot(); | ||
|
||
expect(TEST_CONFIG_INIT_VALUE).toBe(true); | ||
expect(TEST_CONFIG_INIT_VALUE).toMatchSnapshot(); | ||
}); |
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