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

🛠 Tooling: 01-syntactic-sugar tests fail on Node 19 #260

Closed
3 tasks done
rogue0137 opened this issue Apr 19, 2023 · 1 comment · Fixed by #261
Closed
3 tasks done

🛠 Tooling: 01-syntactic-sugar tests fail on Node 19 #260

rogue0137 opened this issue Apr 19, 2023 · 1 comment · Fixed by #261
Assignees
Labels
accepting prs Yes please, send a pull request! ♥ area: tooling Changes around repository management, such as CI, formatting, linting, and releases.

Comments

@rogue0137
Copy link

Tooling Report Checklist

  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my request.
  • This is the appropriate issue form for the tooling issue I would like to report.

Expected

I expected the tests to run and fail when I ran npm run test -- 1.

Actual

I received this error:

 FAIL  01-syntactic-sugar/index.test.js
  ● Test suite failed to run

    TypeError: Cannot assign to read only property 'performance' of object '[object global]'

      at hijackMethod (../../../node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:946:32)
      at Object.install (../../../node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:1733:17)
      at FakeTimers.useFakeTimers (../../../node_modules/@jest/fake-timers/build/modernFakeTimers.js:110:36)

So I went into jest.config.js.

The original file is:

module.exports = {
	fakeTimers: { enableGlobally: true },
	transform: {
		"^.+\\.(t|j)sx?$": [
			"@swc/jest",
			{
				jsc: {
					target: "es2021",
				},
			},
		],
	},
};

I changed it to:

module.exports = {
	fakeTimers: { enableGlobally: false },
	transform: {
		"^.+\\.(t|j)sx?$": [
			"@swc/jest",
			{
				jsc: {
					target: "es2021",
				},
			},
		],
	},
};

After changing enableGlobally from true to false, my tests failed the way I expected them to. I then fixed the obvious issues in my code and the tests passed.

Additional Info

I'm not really sure how to document this finding. Again, it should only affect users with node v19. I didn't try this out, but it was recommended in a post.

My node version is v19.9.0.

@rogue0137 rogue0137 added the area: tooling Changes around repository management, such as CI, formatting, linting, and releases. label Apr 19, 2023
@JoshuaKGoldberg
Copy link
Contributor

👋 thanks for filing this @rogue0137! This is new - and looks like perhaps a result of sinonjs/fake-timers#441? Updating jest and ts-jest to their latest versions seems to fix it.

@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Apr 19, 2023
@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Yes please, send a pull request! ♥ label Apr 19, 2023
@JoshuaKGoldberg JoshuaKGoldberg changed the title 🛠 Tooling: <short description of the request> 🛠 Tooling: 01-syntactic-sugar tests fail on Node 19 Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Yes please, send a pull request! ♥ area: tooling Changes around repository management, such as CI, formatting, linting, and releases.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants