diff --git a/package.json b/package.json index a653e6df9..74141e2ca 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,8 @@ "\\.test\\.skip\\.js$" ], "transform": { - "\\.js$": "@swc/jest" + "\\.js$": "@swc/jest", + "\\.ts$": "@swc/jest" } }, "engines": { diff --git a/src/cli.js b/src/cli.js index 1501e3cef..11c219549 100644 --- a/src/cli.js +++ b/src/cli.js @@ -1,7 +1,7 @@ #!/usr/bin/env node if (process.env.OXIDE) { - module.exports = require('./oxide/cli.js') + module.exports = require('./oxide/cli') } else { - module.exports = require('./cli/index.js') + module.exports = require('./cli/index') } diff --git a/src/index.js b/src/index.js index 74fcd5fee..1e85998bb 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ if (process.env.OXIDE) { - module.exports = require('./oxide/postcss-plugin.js') + module.exports = require('./oxide/postcss-plugin') } else { - module.exports = require('./plugin.js') + module.exports = require('./plugin') } diff --git a/tests/arbitrary-values.test.html b/tests/arbitrary-values.test.html index 698cefcbc..fb2f424f9 100644 --- a/tests/arbitrary-values.test.html +++ b/tests/arbitrary-values.test.html @@ -172,20 +172,10 @@
@@ -382,7 +372,6 @@
-
diff --git a/tests/arbitrary-values.test.js b/tests/arbitrary-values.test.js index afa66b4db..70ed3a661 100644 --- a/tests/arbitrary-values.test.js +++ b/tests/arbitrary-values.test.js @@ -1,8 +1,11 @@ import fs from 'fs' import path from 'path' +import { env } from '../src/lib/sharedState' import { run, html, css } from './util/run' +let oxideSkip = env.OXIDE ? test.skip : test + test('arbitrary values', () => { let config = { content: [path.resolve(__dirname, './arbitrary-values.test.html')], @@ -16,6 +19,23 @@ test('arbitrary values', () => { }) }) +oxideSkip( + 'should only detect classes with arbitrary values that are properly terminated after the arbitrary value', + () => { + let config = { + content: [ + { + raw: html`
`, + }, + ], + } + + return run('@tailwind utilities', config).then((result) => { + return expect(result.css).toMatchFormattedCss(css``) + }) + } +) + it('should be possible to differentiate between decoration utilities', () => { let config = { content: [ diff --git a/tests/blocklist.test.js b/tests/blocklist.test.js index 4adcef839..acd4be359 100644 --- a/tests/blocklist.test.js +++ b/tests/blocklist.test.js @@ -1,12 +1,10 @@ import { run, html, css } from './util/run' +import log from '../src/util/log' let warn beforeEach(() => { - warn = jest.spyOn( - process.env.OXIDE ? require('../lib/util/log').default : require('../src/util/log').default, - 'warn' - ) + warn = jest.spyOn(log, 'warn') }) afterEach(() => warn.mockClear()) diff --git a/tests/context-reuse.test.js b/tests/context-reuse.test.js index 1f678ce16..0846975ef 100644 --- a/tests/context-reuse.test.js +++ b/tests/context-reuse.test.js @@ -83,8 +83,7 @@ it('re-uses the context across multiple files with the same config', async () => expect(dependencies[3]).toEqual([path.resolve(__dirname, 'context-reuse.tailwind.config.js')]) // And none of this should have resulted in multiple contexts being created - let localSharedState = process.env.OXIDE ? require('../lib/lib/sharedState') : sharedState - expect(localSharedState.contextSourcesMap.size).toBe(1) + expect(sharedState.contextSourcesMap.size).toBe(1) }) it('updates layers when any CSS containing @tailwind directives changes', async () => { diff --git a/tests/evaluateTailwindFunctions.test.js b/tests/evaluateTailwindFunctions.test.js index 878a98cca..0a6a4bf39 100644 --- a/tests/evaluateTailwindFunctions.test.js +++ b/tests/evaluateTailwindFunctions.test.js @@ -3,6 +3,7 @@ import path from 'path' import postcss from 'postcss' import plugin from '../src/lib/evaluateTailwindFunctions' import { run as runFull, css, html } from './util/run' +import log from '../src/util/log' function run(input, opts = {}) { return postcss([ @@ -1269,10 +1270,7 @@ describe('context dependent', () => { let warn beforeEach(() => { - warn = jest.spyOn( - process.env.OXIDE ? require('../lib/util/log').default : require('../src/util/log').default, - 'warn' - ) + warn = jest.spyOn(log, 'warn') }) afterEach(() => warn.mockClear()) diff --git a/tests/important-boolean.test.js b/tests/important-boolean.test.js index b09d0abe0..48a7c10f8 100644 --- a/tests/important-boolean.test.js +++ b/tests/important-boolean.test.js @@ -90,8 +90,7 @@ describe('duplicate elision', () => { ` let result = await run(input, config) - let localSharedState = process.env.OXIDE ? require('../lib/lib/sharedState') : sharedState - let allContexts = Array.from(localSharedState.contextMap.values()) + let allContexts = Array.from(sharedState.contextMap.values()) let context = allContexts[allContexts.length - 1] diff --git a/tests/min-max-screen-variants.test.js b/tests/min-max-screen-variants.test.js index 7878812ea..0a6a5fc7f 100644 --- a/tests/min-max-screen-variants.test.js +++ b/tests/min-max-screen-variants.test.js @@ -1,10 +1,10 @@ import { run, css, html } from './util/run' +import log from '../src/util/log' let warn beforeEach(() => { - let log = process.env.OXIDE ? require('../lib/util/log') : require('../src/util/log') - warn = jest.spyOn(log.default, 'warn') + warn = jest.spyOn(log, 'warn') }) afterEach(() => { diff --git a/tests/warnings.test.js b/tests/warnings.test.js index 016745a81..5e8a106a0 100644 --- a/tests/warnings.test.js +++ b/tests/warnings.test.js @@ -1,10 +1,10 @@ import { html, run, css } from './util/run' +import log from '../src/util/log' let warn beforeEach(() => { - let log = process.env.OXIDE ? require('../lib/util/log') : require('../src/util/log') - warn = jest.spyOn(log.default, 'warn') + warn = jest.spyOn(log, 'warn') }) afterEach(() => {