-
Notifications
You must be signed in to change notification settings - Fork 135
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 isMacrosName option #133
Conversation
@kentcdodds I tried adding tests, and they were passing, but for some reason, the test EDIT: Just for reference, here are the tests and fixture I tried adding: // Tests, added to: src/__tests__/index.js, after Line 412
{
title: 'when a custom isMacrosName option is used on a import',
pluginOptions: {
isMacrosName(v) {
return v.endsWith('-macro.js')
},
},
code: `
import myEval from './fixtures/eval-macro.js'
const x = myEval\`34 + 45\`
`,
},
{
title: 'when a custom isMacrosName option is used on a require',
pluginOptions: {
isMacrosName(v) {
return v.endsWith('-macro.js')
},
},
code: `
const evaler = require('./fixtures/eval-macro.js')
const x = evaler\`34 + 45\`
`,
},
// Fixture: src/__tests__/fixtures/eval-macro.js
module.exports = require('./eval.macro.js') |
Thanks! The terminal is interactive with Jest watch mode. Read the output and press the keys that make sense :) |
Without the new tests and fixture:
When I add the new tests and fixture it passes these tests no problem, but
Is there any other way to force Jest to run the tests via |
That's odd. It should definitely run all the tests when you hit You can force it to run the tests with Sorry about the trouble. |
lol A bit late for that, I created a new Just to confirm, before posting this I used // jest.config.js
const path = require('path')
const ignores = [
'/node_modules/',
'/fixtures/',
'/__tests__/helpers/',
'__mocks__',
]
module.exports = {
roots: [path.join(__dirname, 'src')],
testEnvironment: 'node',
testURL: 'http://localhost',
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
collectCoverageFrom: ['src/**/*.+(js|jsx|ts|tsx)'],
testMatch: ['**/__tests__/**/*.+(js|jsx|ts|tsx)'],
testPathIgnorePatterns: [...ignores],
coveragePathIgnorePatterns: [...ignores, 'src/(umd|cjs|esm)-entry.js$'],
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
} Should I do anything else, or is this good to merge? Also, as a side note note related to this PR directly, you might want to:
|
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.
Excellent. Thank you!
@all-contributors please add @futagoza for code and tests |
I've put up a pull request to add @futagoza! 🎉 |
🎉 This PR is included in version 2.7.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
I forgot to update the user docs 😅, should I refork and update it, or you gonna do that later yourself? |
If you could make another pull request that would be great. Thanks! |
What: Resolving #131 by adding a new option called
isMacrosName
for the plugin.Why: Allows the user to selectively accept modules as a macro for this plugin.
How: This option will optionally overwrite the original behaviour, so backwards compatibility is kept.