Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add inter-package version safety check #1265

Merged
merged 5 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions jest.config.js

This file was deleted.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,29 @@
"projects": [
"<rootDir>/packages/*",
"<rootDir>/test-packages/"
],
"testEnvironment": "node",
"testMatch": [
"**/*.test.js"
]
},
"resolutions": {
"**/browserslist": "^4.14.0",
"**/qunit": "^2.14.1"
"**/qunit": "^2.14.1",
"**/graceful-fs": "^4.0.0"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.7",
"@changesets/cli": "^2.25.0",
"@types/jest": "^24.0.0",
"@types/jest": "^29.2.0",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"cross-env": "^7.0.3",
"eslint": "^7.14.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^24.9.0",
"jest": "^29.2.1",
"prettier": "^2.3.1",
"typescript": "4.4.2"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"./src/babel-plugin-inline-hbs": "./src/babel-plugin-inline-hbs.js",
"./src/babel-plugin-stage1-inline-hbs": "./src/babel-plugin-stage1-inline-hbs.js",
"./src/mini-modules-polyfill": "./src/mini-modules-polyfill.js",
"./src/load-ember-template-compiler": "./src/load-ember-template-compiler.js"
"./src/load-ember-template-compiler": "./src/load-ember-template-compiler.js",
"./src/portable-babel-config": "./src/portable-babel-config.js",
"./package.json": "./package.json"
},
"files": [
"src/**/*.js",
Expand Down
1 change: 1 addition & 0 deletions packages/macros/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@types/node": "^15.12.2",
"@types/resolve": "^1.20.0",
"@types/semver": "^7.3.6",
"code-equality-assertions": "^0.7.0",
"typescript": "*"
},
"engines": {
Expand Down
3 changes: 2 additions & 1 deletion packages/macros/tests/babel/eval.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Evaluator, buildLiterals } from '../../src/babel/evaluate-json';
import { NodePath } from '@babel/traverse';
import type * as Babel from '@babel/core';
import { types as t } from '@babel/core';
import 'code-equality-assertions/jest';

describe('evaluation', function () {
allBabelVersions({
Expand All @@ -25,7 +26,7 @@ describe('evaluation', function () {

test('object literal non-nullish member access parses OK', () => {
let code = transform(`const result = { ...content\n}?.[0].content;`);
expect(code).toMatch(`const result = { ...content\n}?.[0].content;`);
expect(code).toEqualCode(`const result = { ...content\n}?.[0].content;`);
});

test('optional chaining nullish member access', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/macros/tests/babel/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ disabledTest.skip = disabledTest;
disabledTest.todo = disabledTest;
disabledTest.concurrent = disabledTest;
disabledTest.each = test.each;
disabledTest.failing = disabledTest;

export function allModes(fn: CreateModeTests): CreateTests {
return function createTests(transform: Transform) {
Expand Down
1 change: 1 addition & 0 deletions packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"ember-source": "*"
},
"devDependencies": {
"@babel/core": "^7.19.6",
"@ember/jquery": "^2.0.0",
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.4.2",
Expand Down
32 changes: 32 additions & 0 deletions tests/scenarios/inter-version-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import QUnit from 'qunit';
import glob from 'globby';
import { resolve } from 'path';
import { readJSONSync } from 'fs-extra';
import { satisfies } from 'semver';

const { module: Qmodule, test } = QUnit;

Qmodule('package inter-version consistency', () => {
let rootDir = resolve(__dirname, '..', '..');
let packages = new Map();
for (let pattern of readJSONSync(resolve(__dirname, '../../package.json')).workspaces.packages) {
for (let dir of glob.sync(pattern, { cwd: rootDir, expandDirectories: false, onlyDirectories: true })) {
let pkg = readJSONSync(resolve(rootDir, dir, 'package.json'));
packages.set(pkg.name, pkg);
test(pkg.name, assert => {
assert.ok('some packages have no interior deps and that is ok');
for (let section of ['dependencies', 'devDependencies', 'peerDependencies']) {
for (let [name, range] of Object.entries(pkg[section] ?? {})) {
let other = packages.get(name);
if (other) {
assert.ok(
satisfies(other.version, range as string),
`${name} in ${section} ${other.version} does not satisfy ${range}`
);
}
}
}
});
}
}
});
1 change: 1 addition & 0 deletions tests/scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"qunit": "^2.16.0",
"resolve": "^1.20.0",
"scenario-tester": "^2.0.1",
"semver": "^7.3.8",
"ts-node": "^9.1.1"
},
"scripts": {
Expand Down
Loading