Files
yarn/packages/pkg-tests/yarn.test.js
Maël Nison 7f41910330 Set up CI with Azure Pipelines (#6495)
* Set up CI with Azure Pipelines

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update package.json

* Adds debug

* Tries using bash

* Tweaks timeouts

* Fixes various things related to the win32 compat

* I get the same 22 failed tests with/without the delay.

* Fix makeFakeBinary for win32.

It needs the ".cmd" extension, otherwise it's ignored.
Remove #!/bin/sh and instead add @echo off to clean output
Use errorCode 0 so we get output and not a Command failed

* Check custom output instead of versions.

Running fake binaries there was no way to get local versions of node or yarn. Am I missing something?

* Remove quotes from echo (not removed in Windows).
Replace ; by /n as the former doesn't actually break statements in Windows batch files.

* Some tweaks

* Fixes syntax

* Fixes tests on Windows

* Adds test reporting

* Fixes things (?)

* Fixes indent

* Always run the test result publishing

* Fixes yml

* Use node scripts to avoid Windows interoperability issues.

* Fixes the "must use the same Node as Yarn itself" test

* Fixes escaping from within the tests

* Removes the accidental .only flag

* Fixes a test on Windows

* Add support for different drives in Windows.

So if code is in D: but temporary folder is in C:, don't try to find a relative path but stay on the absolute one.

* No need to getPackageLocation

* Add support for environment and arguments by using a custom solution instead of cmd-shim.

* Missing escape on path in pnpapi test.

* Some cleaning

* Runs tests on all three platforms

* Fixes write paths

* Fixes normalizePath

* Disables pkg-tests from CircleCI (moved to Azure)

* Increase Windows timeouts and better name Test results (#6680)

* Increase timeout in Windows, we're seeing tests failing randomly and others close to default 5 sec.

* Distinguish tests published from each job.

* Pass name as vmImage is not available

* Remove unnecessary detect unfinished tests.

* Using strategy var instead of parameter

* Use variables instead of strategy

* Revert "Disables pkg-tests from CircleCI (moved to Azure)"

This reverts commit 8f724620b6.
2018-11-14 22:10:44 +00:00

85 lines
2.0 KiB
JavaScript

/* @flow */
const {delimiter} = require(`path`);
const {
tests: {generatePkgDriver, startPackageServer, getPackageRegistry},
exec: {execFile},
} = require(`pkg-tests-core`);
const {
basic: basicSpecs,
dragon: dragonSpecs,
lock: lockSpecs,
pnp: pnpSpecs,
pnpapiV1: pnpapiV1Specs,
script: scriptSpecs,
workspace: workspaceSpecs,
} = require(`pkg-tests-specs`);
const pkgDriver = generatePkgDriver({
async runDriver(
path,
[command, ...args],
{cwd, projectFolder, registryUrl, plugNPlay, plugnplayShebang, plugnplayBlacklist, env},
) {
let beforeArgs = [];
let middleArgs = [];
if (projectFolder) {
beforeArgs = [...beforeArgs, `--cwd`, projectFolder];
}
if (command === 'install') {
middleArgs = [...middleArgs, `--cache-folder`, `${path}/.cache`];
}
const res = await execFile(
process.execPath,
[`${process.cwd()}/../../bin/yarn.js`, ...beforeArgs, command, ...middleArgs, ...args],
{
env: Object.assign(
{
[`NPM_CONFIG_REGISTRY`]: registryUrl,
[`YARN_SILENT`]: `1`,
[`YARN_PROXY`]: ``,
[`YARN_HTTPS_PROXY`]: ``,
[`YARN_PLUGNPLAY_SHEBANG`]: plugnplayShebang || ``,
[`YARN_PLUGNPLAY_BLACKLIST`]: plugnplayBlacklist || ``,
[`PATH`]: `${path}/bin${delimiter}${process.env.PATH}`,
},
plugNPlay ? {[`YARN_PLUGNPLAY_OVERRIDE`]: plugNPlay ? `1` : `0`} : {},
env,
),
cwd: cwd || path,
},
);
if (process.env.JEST_LOG_SPAWNS) {
console.log(`===== stdout:`);
console.log(res.stdout);
console.log(`===== stderr:`);
console.log(res.stderr);
}
return res;
},
});
if (process.platform === `win32`) {
jest.setTimeout(10000);
}
beforeEach(async () => {
await startPackageServer();
await getPackageRegistry();
});
basicSpecs(pkgDriver);
lockSpecs(pkgDriver);
scriptSpecs(pkgDriver);
workspaceSpecs(pkgDriver);
pnpSpecs(pkgDriver);
pnpapiV1Specs(pkgDriver);
dragonSpecs(pkgDriver);