Jest No Tests found
running docker mhart/alpine-node:8 on macOS with
nodejs (6.10.3-r0) (18/18)
yarn 0.24.6
jest 20.0.4
I have a __tests__/index.test.js file however, when running the code
node_modules/.bin/jest --watchAll
I get the below output
No tests found
In /usr/src/app
5 files checked.
testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match
testPathIgnorePatterns: /node_modules/,/src,src - 0 matches
Pattern: "" - 0 matches
I've re-installed the package numbers times but to no avail.
javascript node.js unit-testing jestjs
add a comment |
running docker mhart/alpine-node:8 on macOS with
nodejs (6.10.3-r0) (18/18)
yarn 0.24.6
jest 20.0.4
I have a __tests__/index.test.js file however, when running the code
node_modules/.bin/jest --watchAll
I get the below output
No tests found
In /usr/src/app
5 files checked.
testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match
testPathIgnorePatterns: /node_modules/,/src,src - 0 matches
Pattern: "" - 0 matches
I've re-installed the package numbers times but to no avail.
javascript node.js unit-testing jestjs
add a comment |
running docker mhart/alpine-node:8 on macOS with
nodejs (6.10.3-r0) (18/18)
yarn 0.24.6
jest 20.0.4
I have a __tests__/index.test.js file however, when running the code
node_modules/.bin/jest --watchAll
I get the below output
No tests found
In /usr/src/app
5 files checked.
testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match
testPathIgnorePatterns: /node_modules/,/src,src - 0 matches
Pattern: "" - 0 matches
I've re-installed the package numbers times but to no avail.
javascript node.js unit-testing jestjs
running docker mhart/alpine-node:8 on macOS with
nodejs (6.10.3-r0) (18/18)
yarn 0.24.6
jest 20.0.4
I have a __tests__/index.test.js file however, when running the code
node_modules/.bin/jest --watchAll
I get the below output
No tests found
In /usr/src/app
5 files checked.
testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match
testPathIgnorePatterns: /node_modules/,/src,src - 0 matches
Pattern: "" - 0 matches
I've re-installed the package numbers times but to no avail.
javascript node.js unit-testing jestjs
javascript node.js unit-testing jestjs
edited Jun 6 '18 at 23:56
Serhii Matrunchyk
95511834
95511834
asked Jun 24 '17 at 23:11
KendallKendall
1,46862546
1,46862546
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
Your output says that testMatch
had 1 match
, which may be your __tests__/index.test.js
file. It seems that your testPathIgnorePatterns
is causing that test suite to be ignored. No tests found In /usr/src/app
says that Jest is looking for tests in /usr/src/app
, and testPathIgnorePatterns: /node_modules/,/src,src
says that Jest is ignoring files in /src
directories.
Either point Jest to look at the location of your __tests__/index.test.js
file if it is outside the /src directory, or stop testPathIgnorePatterns
from ignoring the /src directory.
add a comment |
If you want to run all the tests inside the tests folder you can simply do the following
jest __tests__ --watch
add a comment |
I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.
add a comment |
You can try running jest
without any parameters. A key thing to note is the test file names have to follow the convention *.test.js
.
add a comment |
If you have file structure such as the following
myFolder
│ myFile1.js
│ myFile2.js
│ ...
│
└───__tests__
myFile1.spec.js
myFile2.spec.js
...
then you need to have in jest.config.js
the following pattern for testMatch
property:
testMatch: ['**/__tests__/*.js?(x)'],
The simple example of jest.config.js
:
const jestConfig = {
verbose: true,
testURL: "http://localhost/",
'transform': {
'^.+\.jsx?$': 'babel-jest',
},
testMatch: ['**/__tests__/*.js?(x)'],
}
module.exports = jestConfig
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44741766%2fjest-no-tests-found%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your output says that testMatch
had 1 match
, which may be your __tests__/index.test.js
file. It seems that your testPathIgnorePatterns
is causing that test suite to be ignored. No tests found In /usr/src/app
says that Jest is looking for tests in /usr/src/app
, and testPathIgnorePatterns: /node_modules/,/src,src
says that Jest is ignoring files in /src
directories.
Either point Jest to look at the location of your __tests__/index.test.js
file if it is outside the /src directory, or stop testPathIgnorePatterns
from ignoring the /src directory.
add a comment |
Your output says that testMatch
had 1 match
, which may be your __tests__/index.test.js
file. It seems that your testPathIgnorePatterns
is causing that test suite to be ignored. No tests found In /usr/src/app
says that Jest is looking for tests in /usr/src/app
, and testPathIgnorePatterns: /node_modules/,/src,src
says that Jest is ignoring files in /src
directories.
Either point Jest to look at the location of your __tests__/index.test.js
file if it is outside the /src directory, or stop testPathIgnorePatterns
from ignoring the /src directory.
add a comment |
Your output says that testMatch
had 1 match
, which may be your __tests__/index.test.js
file. It seems that your testPathIgnorePatterns
is causing that test suite to be ignored. No tests found In /usr/src/app
says that Jest is looking for tests in /usr/src/app
, and testPathIgnorePatterns: /node_modules/,/src,src
says that Jest is ignoring files in /src
directories.
Either point Jest to look at the location of your __tests__/index.test.js
file if it is outside the /src directory, or stop testPathIgnorePatterns
from ignoring the /src directory.
Your output says that testMatch
had 1 match
, which may be your __tests__/index.test.js
file. It seems that your testPathIgnorePatterns
is causing that test suite to be ignored. No tests found In /usr/src/app
says that Jest is looking for tests in /usr/src/app
, and testPathIgnorePatterns: /node_modules/,/src,src
says that Jest is ignoring files in /src
directories.
Either point Jest to look at the location of your __tests__/index.test.js
file if it is outside the /src directory, or stop testPathIgnorePatterns
from ignoring the /src directory.
answered Aug 13 '17 at 14:04
Zachary Ryan SmithZachary Ryan Smith
1,14911120
1,14911120
add a comment |
add a comment |
If you want to run all the tests inside the tests folder you can simply do the following
jest __tests__ --watch
add a comment |
If you want to run all the tests inside the tests folder you can simply do the following
jest __tests__ --watch
add a comment |
If you want to run all the tests inside the tests folder you can simply do the following
jest __tests__ --watch
If you want to run all the tests inside the tests folder you can simply do the following
jest __tests__ --watch
answered Nov 28 '17 at 17:55
Abu KhadijaAbu Khadija
364
364
add a comment |
add a comment |
I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.
add a comment |
I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.
add a comment |
I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.
I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.
answered Aug 14 '18 at 10:02
mikehmikeh
626618
626618
add a comment |
add a comment |
You can try running jest
without any parameters. A key thing to note is the test file names have to follow the convention *.test.js
.
add a comment |
You can try running jest
without any parameters. A key thing to note is the test file names have to follow the convention *.test.js
.
add a comment |
You can try running jest
without any parameters. A key thing to note is the test file names have to follow the convention *.test.js
.
You can try running jest
without any parameters. A key thing to note is the test file names have to follow the convention *.test.js
.
answered Nov 25 '18 at 0:38
KaruhangaKaruhanga
4171415
4171415
add a comment |
add a comment |
If you have file structure such as the following
myFolder
│ myFile1.js
│ myFile2.js
│ ...
│
└───__tests__
myFile1.spec.js
myFile2.spec.js
...
then you need to have in jest.config.js
the following pattern for testMatch
property:
testMatch: ['**/__tests__/*.js?(x)'],
The simple example of jest.config.js
:
const jestConfig = {
verbose: true,
testURL: "http://localhost/",
'transform': {
'^.+\.jsx?$': 'babel-jest',
},
testMatch: ['**/__tests__/*.js?(x)'],
}
module.exports = jestConfig
add a comment |
If you have file structure such as the following
myFolder
│ myFile1.js
│ myFile2.js
│ ...
│
└───__tests__
myFile1.spec.js
myFile2.spec.js
...
then you need to have in jest.config.js
the following pattern for testMatch
property:
testMatch: ['**/__tests__/*.js?(x)'],
The simple example of jest.config.js
:
const jestConfig = {
verbose: true,
testURL: "http://localhost/",
'transform': {
'^.+\.jsx?$': 'babel-jest',
},
testMatch: ['**/__tests__/*.js?(x)'],
}
module.exports = jestConfig
add a comment |
If you have file structure such as the following
myFolder
│ myFile1.js
│ myFile2.js
│ ...
│
└───__tests__
myFile1.spec.js
myFile2.spec.js
...
then you need to have in jest.config.js
the following pattern for testMatch
property:
testMatch: ['**/__tests__/*.js?(x)'],
The simple example of jest.config.js
:
const jestConfig = {
verbose: true,
testURL: "http://localhost/",
'transform': {
'^.+\.jsx?$': 'babel-jest',
},
testMatch: ['**/__tests__/*.js?(x)'],
}
module.exports = jestConfig
If you have file structure such as the following
myFolder
│ myFile1.js
│ myFile2.js
│ ...
│
└───__tests__
myFile1.spec.js
myFile2.spec.js
...
then you need to have in jest.config.js
the following pattern for testMatch
property:
testMatch: ['**/__tests__/*.js?(x)'],
The simple example of jest.config.js
:
const jestConfig = {
verbose: true,
testURL: "http://localhost/",
'transform': {
'^.+\.jsx?$': 'babel-jest',
},
testMatch: ['**/__tests__/*.js?(x)'],
}
module.exports = jestConfig
answered Jan 19 at 4:36
RomanRoman
3,0171930
3,0171930
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44741766%2fjest-no-tests-found%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown