mirror of
https://github.com/strapi/strapi.git
synced 2025-07-03 15:11:19 +00:00
Run Jest in the monorepo packages
This commit is contained in:
parent
eef86d1bd6
commit
c2d0e81f22
13
jest.config.js
Normal file
13
jest.config.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'setup',
|
||||||
|
displayName: 'Setup',
|
||||||
|
testPathIgnorePatterns: [
|
||||||
|
'<rootDir>/packages/',
|
||||||
|
],
|
||||||
|
coveragePathIgnorePatterns: [
|
||||||
|
'<rootDir>/dist/',
|
||||||
|
'<rootDir>/node_modules/',
|
||||||
|
'<rootDir>/out-tsc/',
|
||||||
|
'<rootDir>/test/'
|
||||||
|
]
|
||||||
|
};
|
10
packages/strapi-plugin-content-manager/jest.config.js
Normal file
10
packages/strapi-plugin-content-manager/jest.config.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
name: 'content-manager',
|
||||||
|
displayName: 'Content Manager',
|
||||||
|
coveragePathIgnorePatterns: [
|
||||||
|
'<rootDir>/dist/',
|
||||||
|
'<rootDir>/node_modules/',
|
||||||
|
'<rootDir>/out-tsc/',
|
||||||
|
'<rootDir>/test/'
|
||||||
|
]
|
||||||
|
};
|
@ -0,0 +1,8 @@
|
|||||||
|
describe('Content-Manager', () => {
|
||||||
|
test(
|
||||||
|
'True',
|
||||||
|
async () => {
|
||||||
|
expect(true).toBeTruthy();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
@ -36,7 +36,7 @@ module.exports = function() {
|
|||||||
}),
|
}),
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
// Load configurations.
|
// Load configurations.
|
||||||
glob('{./plugins/*/!(config|node_modules)/*.*(js|json),./plugins/*/package.json}', {
|
glob('{./plugins/*/!(config|node_modules|test)/*.*(js|json),./plugins/*/package.json}', {
|
||||||
cwd: this.config.appPath
|
cwd: this.config.appPath
|
||||||
}, (err, files) => {
|
}, (err, files) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -51,6 +51,7 @@ const main = async () => {
|
|||||||
|
|
||||||
const start = () => {
|
const start = () => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
try {
|
||||||
appStart = exec(
|
appStart = exec(
|
||||||
`node ${strapiBin} start ${appName}`,
|
`node ${strapiBin} start ${appName}`,
|
||||||
);
|
);
|
||||||
@ -62,18 +63,29 @@ const main = async () => {
|
|||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const test = () => {
|
const test = () => {
|
||||||
console.log('Launch test suits');
|
|
||||||
return new Promise(async (resolve) => {
|
return new Promise(async (resolve) => {
|
||||||
const options = {
|
// Run setup tests to generate the app.
|
||||||
projects: [process.cwd()],
|
await jest({
|
||||||
silent: false
|
passWithNoTests: true
|
||||||
};
|
}, [process.cwd()]);
|
||||||
|
|
||||||
await jest(options, options.projects);
|
const packages = fs.readdirSync(path.resolve(process.cwd(), 'packages'))
|
||||||
|
.filter(file => file.indexOf('strapi') !== -1);
|
||||||
|
|
||||||
|
// Run tests in every packages.
|
||||||
|
for (let i in packages) {
|
||||||
|
await jest({
|
||||||
|
passWithNoTests: true
|
||||||
|
}, [`${process.cwd()}/packages/${packages[i]}`]);
|
||||||
|
}
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user