diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000000..007114a9bd --- /dev/null +++ b/jest.config.js @@ -0,0 +1,13 @@ +module.exports = { + name: 'setup', + displayName: 'Setup', + testPathIgnorePatterns: [ + '/packages/', + ], + coveragePathIgnorePatterns: [ + '/dist/', + '/node_modules/', + '/out-tsc/', + '/test/' + ] +}; diff --git a/packages/strapi-plugin-content-manager/jest.config.js b/packages/strapi-plugin-content-manager/jest.config.js new file mode 100644 index 0000000000..01646b6fcf --- /dev/null +++ b/packages/strapi-plugin-content-manager/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + name: 'content-manager', + displayName: 'Content Manager', + coveragePathIgnorePatterns: [ + '/dist/', + '/node_modules/', + '/out-tsc/', + '/test/' + ] +}; diff --git a/packages/strapi-plugin-content-manager/test/index.test.js b/packages/strapi-plugin-content-manager/test/index.test.js new file mode 100644 index 0000000000..7350507486 --- /dev/null +++ b/packages/strapi-plugin-content-manager/test/index.test.js @@ -0,0 +1,8 @@ +describe('Content-Manager', () => { + test( + 'True', + async () => { + expect(true).toBeTruthy(); + } + ); +}); diff --git a/packages/strapi-plugin-graphql/package.json b/packages/strapi-plugin-graphql/package.json index 301b5783f4..99005652a3 100644 --- a/packages/strapi-plugin-graphql/package.json +++ b/packages/strapi-plugin-graphql/package.json @@ -48,4 +48,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-users-permissions/models/User.settings.json b/packages/strapi-plugin-users-permissions/models/User.settings.json index 99479b1cba..da72db76e3 100644 --- a/packages/strapi-plugin-users-permissions/models/User.settings.json +++ b/packages/strapi-plugin-users-permissions/models/User.settings.json @@ -40,4 +40,4 @@ "configurable": false } } -} +} \ No newline at end of file diff --git a/packages/strapi/lib/core/apis.js b/packages/strapi/lib/core/apis.js index ebbbd43e4a..5ccbcd2754 100755 --- a/packages/strapi/lib/core/apis.js +++ b/packages/strapi/lib/core/apis.js @@ -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) { diff --git a/test/start.js b/test/start.js index e8049caa98..e0c1a99049 100644 --- a/test/start.js +++ b/test/start.js @@ -51,29 +51,41 @@ const main = async () => { const start = () => { return new Promise((resolve) => { - appStart = exec( - `node ${strapiBin} start ${appName}`, - ); + try { + appStart = exec( + `node ${strapiBin} start ${appName}`, + ); - appStart.stdout.on('data', data => { - console.log(data.toString()); + appStart.stdout.on('data', data => { + console.log(data.toString()); - if (data.includes('To shut down your server')) { - return resolve(); - } - }); + if (data.includes('To shut down your server')) { + 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(); });