Skip to content

Commit

Permalink
Add partial windows coverage
Browse files Browse the repository at this point in the history
Skip PNP & Workspace tests -> Tracking issue: #100
  • Loading branch information
stefanpenner committed Feb 14, 2020
1 parent fedbfa6 commit c02bd81
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
node: ['10', '12']
os: [ubuntu-latest, macOS-latest]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v1
Expand Down
91 changes: 47 additions & 44 deletions tests/index-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const VersionChecker = require('..');
const execSync = require('child_process').execSync;
const semver = require('semver');

// There are some issues with PNP + worksapces on windows that will require debugging
// https://github.com/ember-cli/ember-cli-version-checker/issues/100
const skipWindows = process.platform.includes('win32') ? describe.skip : describe;

function isObject(x) {
return typeof x === 'object' && x !== null;
}
Expand Down Expand Up @@ -501,59 +505,58 @@ describe('ember-cli-version-checker', function() {
});
}

if (semver.gte(process.versions.node, '8.0.0')) {
describe('with yarn pnp', function() {
this.timeout(600000);

beforeEach(function() {
process.chdir(projectRoot.path());

projectRoot.write({
'package.json': JSON.stringify({
private: true,
name: 'test-project',
version: '0.0.0',
dependencies: {
'ember-source-channel-url': '1.1.0',
'ember-cli-version-checker': `link:${ROOT}`,
},
installConfig: {
pnp: true,
},
}),
'index.js': buildVersionCheckerBin(`{
root: process.cwd(),
isEmberCLIProject() {},
}`),
});
skipWindows('with yarn pnp', function() {
this.timeout(600000);

execSync('yarn');
});
beforeEach(function() {
process.chdir(projectRoot.path());

afterEach(function() {
process.chdir(ROOT);
projectRoot.write({
'package.json': JSON.stringify({
private: true,
name: 'test-project',
version: '0.0.0',
dependencies: {
'ember-source-channel-url': '1.1.0',
'ember-cli-version-checker': `link:${ROOT}`,
},
installConfig: {
pnp: true,
},
}),
'index.js': buildVersionCheckerBin(`{
root: process.cwd(),
isEmberCLIProject() {},
}`),
});

it('finds packages that are present', function() {
let result = execSync(
'node -r ./.pnp.js ./index.js ember-source-channel-url'
);
execSync('yarn');
});

assert.strictEqual(
result.toString(),
'ember-source-channel-url: 1.1.0\n'
);
});
afterEach(function() {
process.chdir(ROOT);
});

it('does not find packages that are missing', function() {
let result = execSync('node -r ./.pnp.js ./index.js blah-blah-blah');
it('finds packages that are present', function() {
let result = execSync(
'node -r ./.pnp.js ./index.js ember-source-channel-url'
);

assert.strictEqual(result.toString(), 'blah-blah-blah: undefined\n');
});
assert.strictEqual(
result.toString(),
'ember-source-channel-url: 1.1.0\n'
);
});
}

describe('with yarn workspace', function() {
it('does not find packages that are missing', function() {
let result = execSync('node -r ./.pnp.js ./index.js blah-blah-blah');

assert.strictEqual(result.toString(), 'blah-blah-blah: undefined\n');
});
});


skipWindows('with yarn workspace', function() {
this.timeout(600000);

beforeEach(function() {
Expand Down

0 comments on commit c02bd81

Please sign in to comment.