mirror of
https://github.com/strapi/strapi.git
synced 2025-06-27 00:41:25 +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) => {
|
||||
// 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
|
||||
}, (err, files) => {
|
||||
if (err) {
|
||||
|
@ -51,6 +51,7 @@ const main = async () => {
|
||||
|
||||
const start = () => {
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
appStart = exec(
|
||||
`node ${strapiBin} start ${appName}`,
|
||||
);
|
||||
@ -62,18 +63,29 @@ const main = async () => {
|
||||
return resolve();
|
||||
}
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const test = () => {
|
||||
console.log('Launch test suits');
|
||||
return new Promise(async (resolve) => {
|
||||
const options = {
|
||||
projects: [process.cwd()],
|
||||
silent: false
|
||||
};
|
||||
// Run setup tests to generate the app.
|
||||
await jest({
|
||||
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();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user