-
Notifications
You must be signed in to change notification settings - Fork 192
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
Prevent #1688 (and other accidental prettier breakages) #1689
Changes from all commits
bcf1cd3
07347e6
67841dc
0e3dde1
dcebdb4
42ee4d0
4554a5a
85685a9
b22bc20
41c9a7b
e484f96
ba76cdb
ddd5f2b
2d05f5a
5de9010
05069ee
c31c56d
ebf3909
8074cd1
b161bc5
09d3fc0
3207df8
e6c337d
1003ff5
75061ca
5455815
4a89ee9
8206d97
3e14e23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
/dist | ||
**/dist | ||
/control-dist/ | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
packages/ | ||
pnpm-lock.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "@glimmer-workspace/integration-node-tests", | ||
"version": "0.92.0", | ||
"type": "module", | ||
"private": true, | ||
"repo-meta": { | ||
"strictness": "loose" | ||
}, | ||
"scripts": { | ||
"test:node": "vitest --run" | ||
}, | ||
"dependencies": { | ||
"@glimmer/syntax": "workspace:*", | ||
"execa": "^9.5.2", | ||
"prettier": "^3.4.2" | ||
}, | ||
"devDependencies": { | ||
"@glimmer-workspace/repo-metadata": "workspace:*", | ||
"vitest": "^3.0.4" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createRequire } from 'node:module'; | ||
|
||
import * as prettier from 'prettier'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
const require = createRequire(import.meta.url); | ||
|
||
/** | ||
* See: https://github.com/glimmerjs/glimmer-vm/issues/1688 | ||
* | ||
* Requires the root package.json#pnpm#overrides point at our internal | ||
* copy of @glimmer/syntax, or else prettier brings its own already published | ||
* copy of @glimmer/syntax | ||
* | ||
* NOTE: that this test alone is insufficient to test our built outputs. | ||
* the smoke-tests/* folders are for that purpose. | ||
*/ | ||
describe('Prettier', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love having formal prettier tests. |
||
it(`SMOKE: we've symlinked to the in-repo copy of @glimmer/syntax`, () => { | ||
let workspacePath = require.resolve('@glimmer/syntax'); | ||
let prettierPath = require.resolve('prettier'); | ||
let prettierGlimmer = require.resolve('@glimmer/syntax', { paths: [prettierPath] }); | ||
|
||
expect(prettierGlimmer).toBe(workspacePath); | ||
}); | ||
|
||
it('Underlynig preprocess API works', async () => { | ||
let result = (await import('@glimmer/syntax')).preprocess('<h1></h1>'); | ||
|
||
expect(result, `It can be await import()'d, and doesn't error`).toBeTruthy(); | ||
}); | ||
|
||
it('Prettier can call preprocess', async () => { | ||
let result = await prettier.format(` <div>\n</div>`, { parser: 'glimmer' }); | ||
|
||
expect(result).toMatchInlineSnapshot(` | ||
"<div> | ||
</div>" | ||
`); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,8 @@ export function assertPresent<T>(value: T, message?: string): asserts value is P | |
} | ||
} | ||
|
||
export function isPresentArray<T>(list: readonly T[]): list is PresentArray<T> { | ||
return list.length > 0; | ||
export function isPresentArray<T>(list?: readonly T[]): list is PresentArray<T> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm... what uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nothing -- it's a minification bug! input: private matchFor(
left: OffsetKind,
right: OffsetKind
): (left: PositionData, right: PositionData) => Out {
const nesteds = this._whens.match(left);
localAssert(
isPresentArray(nesteds),
`no match defined for (${left}, ${right}) and no AnyMatch defined either`
);
const callback = new WhenList(nesteds).first(right);
localAssert(
callback !== null,
`no match defined for (${left}, ${right}) and no AnyMatch defined either`
);
return callback;
} output: matchFor(t, e) {
const s = this._whens.match(t);
return P(), new I(s).first(e);
} |
||
return list ? list.length > 0 : false; | ||
} | ||
|
||
export function ifPresent<T, U, V>( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing was calling
test:node
prior to this PR, and run-node-tests called globalember
, which isn't used in CI