Change test:installation so it also causes run-time errors to appear
This commit is contained in:
parent
331b1cb9a0
commit
e3cfa6363d
@ -13,11 +13,14 @@ import { utils } from './utils/utils';
|
|||||||
const registry = IS_LOCAL_PUBLISH ? 'http://localhost:4873/' : 'https://registry.npmjs.org/';
|
const registry = IS_LOCAL_PUBLISH ? 'http://localhost:4873/' : 'https://registry.npmjs.org/';
|
||||||
const monorepoRootPath = path.join(__dirname, '../../..');
|
const monorepoRootPath = path.join(__dirname, '../../..');
|
||||||
const packages = utils.getTopologicallySortedPackages(monorepoRootPath);
|
const packages = utils.getTopologicallySortedPackages(monorepoRootPath);
|
||||||
const installablePackages = _.filter(
|
const preInstallablePackages = _.filter(
|
||||||
packages,
|
packages,
|
||||||
pkg => !pkg.packageJson.private && !_.isUndefined(pkg.packageJson.main) && pkg.packageJson.main.endsWith('.js'),
|
pkg => !pkg.packageJson.private && !_.isUndefined(pkg.packageJson.main) && pkg.packageJson.main.endsWith('.js'),
|
||||||
);
|
);
|
||||||
utils.log('Testing packages:');
|
utils.log('Testing packages:');
|
||||||
|
const installablePackages = _.filter(preInstallablePackages, pkg => {
|
||||||
|
return pkg.packageJson.name === '0x.js';
|
||||||
|
});
|
||||||
_.map(installablePackages, pkg => utils.log(`* ${pkg.packageJson.name}`));
|
_.map(installablePackages, pkg => utils.log(`* ${pkg.packageJson.name}`));
|
||||||
for (const installablePackage of installablePackages) {
|
for (const installablePackage of installablePackages) {
|
||||||
const changelogPath = path.join(installablePackage.location, 'CHANGELOG.json');
|
const changelogPath = path.join(installablePackage.location, 'CHANGELOG.json');
|
||||||
@ -35,7 +38,7 @@ import { utils } from './utils/utils';
|
|||||||
cwd: testDirectory,
|
cwd: testDirectory,
|
||||||
});
|
});
|
||||||
const indexFilePath = path.join(testDirectory, 'index.ts');
|
const indexFilePath = path.join(testDirectory, 'index.ts');
|
||||||
fs.writeFileSync(indexFilePath, `import * as Package from '${packageName}';\n`);
|
fs.writeFileSync(indexFilePath, `import * as Package from '${packageName}';\nconsole.log(Package);\n`);
|
||||||
const tsConfig = {
|
const tsConfig = {
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
typeRoots: ['node_modules/@0xproject/typescript-typings/types', 'node_modules/@types'],
|
typeRoots: ['node_modules/@0xproject/typescript-typings/types', 'node_modules/@types'],
|
||||||
@ -55,7 +58,11 @@ import { utils } from './utils/utils';
|
|||||||
const tscBinaryPath = path.join(monorepoRootPath, './node_modules/typescript/bin/tsc');
|
const tscBinaryPath = path.join(monorepoRootPath, './node_modules/typescript/bin/tsc');
|
||||||
await execAsync(tscBinaryPath, { cwd: testDirectory });
|
await execAsync(tscBinaryPath, { cwd: testDirectory });
|
||||||
utils.log(`Successfully compiled with ${packageName} as a dependency`);
|
utils.log(`Successfully compiled with ${packageName} as a dependency`);
|
||||||
rimraf.sync(testDirectory);
|
const transpiledIndexFilePath = path.join(testDirectory, 'index.js');
|
||||||
|
utils.log(`Running test script with ${packageName} imported`);
|
||||||
|
await execAsync(`node ${transpiledIndexFilePath}`);
|
||||||
|
utils.log(`Successfilly ran test script with ${packageName} imported`);
|
||||||
|
// rimraf.sync(testDirectory);
|
||||||
}
|
}
|
||||||
})().catch(err => {
|
})().catch(err => {
|
||||||
utils.log(err.stderr);
|
utils.log(err.stderr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user