Skip to content

Commit

Permalink
Tests: fix after big refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x authored and Milan Felix Šulc committed Aug 16, 2019
1 parent 64fbef8 commit d152508
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
16 changes: 10 additions & 6 deletions package.json
@@ -1,15 +1,19 @@
{
"scripts": {
"watch": "tsc --watch",
"build": "tsc",
"test": "tsc && jest --verbose",
"test-watch": "jest --verbose --watch",
"prepublishOnly": "tsc"
"test": "jest --verbose",
"test-watch": "jest --verbose --watch"
},
"jest": {
"testEnvironment": "node",
"testMatch": [
"**/spec/**/*.[jt]s?(x)"
"**/spec/**/*.js"
],
"testPathIgnorePatterns": [
"/docs",
"/errors",
"/examples",
"/node_modules",
"/packages"
],
"rootDir": "."
},
Expand Down
2 changes: 1 addition & 1 deletion test/lib/deployment/test-deployment.js
Expand Up @@ -33,7 +33,7 @@ async function testDeployment(
// Load nowignore from fixture dir
let nowIgnoreGlob = '';
const nowIgnoreFile = `${fixturePath}/.nowignore`;
if (fs.exists(nowIgnoreFile)) {
if (fs.existsSync(nowIgnoreFile)) {
console.log('nowignore file found', nowIgnoreFile);
const ignores = fs.readFileSync(nowIgnoreFile).toString().split('\n').filter((el) => el.length > 0);
nowIgnoreGlob = '!(' + ignores.join('|') + ')';
Expand Down
17 changes: 7 additions & 10 deletions test/spec/fixtures.js
@@ -1,4 +1,3 @@
/* global beforeAll, expect, it, jest */
const fs = require('fs');
const path = require('path');

Expand All @@ -12,7 +11,7 @@ const buildUtilsUrl = '@canary';
let builderUrl;

beforeAll(async () => {
const builderPath = path.resolve(__dirname, '..', '..');
const builderPath = path.resolve(__dirname, '../../packages/php');
console.log('builderPath', builderPath);
builderUrl = await packAndDeploy(builderPath);
console.log('builderUrl', builderUrl);
Expand All @@ -24,20 +23,18 @@ const fixturesPath = path.resolve(__dirname, '..', 'fixtures');
if (process.env.FIXTURE) {
testFixture(process.env.FIXTURE);
} else {
// eslint-disable-next-line no-restricted-syntax
for (const fixture of fs.readdirSync(fixturesPath)) {
testFixture(fixture);
}
}

function testFixture(fixture) {
// eslint-disable-next-line no-loop-func
it(`should build ${fixture}`, async () => {
await expect(
testDeployment(
{ builderUrl, buildUtilsUrl },
path.join(fixturesPath, fixture),
),
).resolves.toBeDefined();
const res = await testDeployment(
{ builderUrl, buildUtilsUrl },
path.join(fixturesPath, fixture),
);

expect(res).toBeDefined();
});
}

0 comments on commit d152508

Please sign in to comment.