jasongwartz / bazel_rules_nodejs_contrib Goto Github PK
View Code? Open in Web Editor NEWEcosia specific JS Bazel rules to be used with the NodeJS rules
License: Apache License 2.0
Ecosia specific JS Bazel rules to be used with the NodeJS rules
License: Apache License 2.0
I'm trying to use node_jest_test (from the jest_rules
branch) to run our test suite. Here's the rule in our BUILD file (some names changed to protect the innocent):
nodejs_jest_test(
name="testsuite",
srcs=[
"//my_project/frontend:tests",
],
data=[
"//my_project/frontend:frontend",
":.babelrc",
":jest-test-env.js",
":package.json",
":webpack.babel.js",
],
config=":jest.json",
deps=[
"@npm_my_project//node_modules/babel-jest:babel-jest__pkg",
"@npm_my_project//node_modules/babel-preset-es2015:babel-preset-es2015__pkg",
"@npm_my_project//node_modules/fs-extra:fs-extra__pkg",
"@npm_my_project//node_modules/jest-cli:jest-cli__pkg",
],
)
where //my_project/frontend:tests
is a glob for all *.test.js
files and //my_project/frontend:frontend
is a glob for all files. Here's my jest.json
:
{
"bail": false,
"globals": {
"window": true,
"App": true
},
"setupFiles": [
"<rootDir>/jest-test-env.js"
],
"moduleFileExtensions": [
"js",
"json"
],
"moduleDirectories": [
"<rootDir>/../../external/npm_my_project/node_modules",
"<rootDir>/external/npm_my_project/node_modules",
"<rootDir>/my_project/frontend/modules",
"my_project/frontend/modules",
"<rootDir>/frontend/modules",
"frontend/modules",
"<rootDir>"
],
"moduleNameMapper": {
"\\.(css|scss)$": "<rootDir>/__mocks__/styleMock.js",
"\\.(gif|ttf|eot|svg|png)$": "<rootDir>/__mocks__/fileMock.js"
}
}
It tries to run the tests, but every test fails with the following trace:
FAIL frontend/modules/ncex_redux/reducers/tests/theme-reducer.test.js
â Test suite failed to run
Couldn't find preset "es2015" relative to directory ".../my_project"
at ../../../../../../../../../../../../../../external/npm_my_project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
I've tried a bunch of different version of jest
and babel-jest
(20.0.3 and 23.2.0), but no luck. Any suggestions? :|
Given the following rule, it seems like anything that depends on my-interface
has to also add the transitive @npm//lib-used-by-my-interface
dep. Is that expected and is there any way to get around it?
js_library(
name = "my-interface",
deps = ["@npm//lib-used-by-my-interface"],
...
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.