Skip to content
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
6 changes: 0 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@ module.exports = {
rules: {
'prettier/prettier': 2,
},
overrides: [
{
files: '**/__tests__/*.js',
env: { jest: true },
},
],
}
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"types": "index.d.ts",
"scripts": {
"build": "rollup ./src/index.js -o index.js --f cjs && babel index.js -o index.js",
"test": "jest",
"test:watch": "jest --watch",
"test": "vitest",
"test:watch": "vitest --watch",
Comment on lines 8 to +10
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn run test now runs vitest, but the repo’s CI config in .travis.yml runs Node 6/8/10/12. Vitest (and its Vite dependency) will not run on those Node versions, so CI will fail unless you also bump the CI Node matrix / declare an engines.node range (or pin Vitest to a version compatible with the supported Node versions).

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming a change to GitHub Actions in another PR will get merged, solving this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pull in latest and we'll see if it runs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely! Done.

"lint": "eslint src",
"prepublish": "npm run build",
"precommit": "lint-staged",
Expand Down Expand Up @@ -35,21 +35,19 @@
"url": "https://github.com/styled-components/css-to-react-native/issues"
},
"homepage": "https://github.com/styled-components/css-to-react-native#readme",
"jest": {
"testURL": "http://localhost"
},
"devDependencies": {
"@babel/cli": "^7.6.2",
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.6.2",
"eslint": "^4.17.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-prettier": "^2.6.0",
"jest": "^24.9.0",
"lint-staged": "^6.1.0",
"prettier": "^1.18.2",
"rollup": "^1.22.0"
"rollup": "^1.22.0",
"vitest": "^4.0.1"
},
"dependencies": {
"camelize": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/aspectRatio.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('handles regular aspect ratio values', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/border.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms border none', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/borderColor.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms border color with multiple values', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/boxModel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms margin, padding with 1 value', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/boxShadow.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms box-shadow into shadow- properties', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/colors.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms hex colors', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/flex.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms flex shorthand with 3 values', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/flexFlow.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms flexFlow shorthand with two values', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/font.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms font', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/fontFamily.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms font-family with double quotes', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/fontVariant.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms font variant as an array', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/fontWeight.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms font weights as strings', () => {
Expand Down
22 changes: 10 additions & 12 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { expect, it, vi } from 'vitest'

import transformCss, { getStylesForProperty } from '..'

it('transforms numbers', () => {
expect(transformCss([['z-index', '0']])).toEqual({ zIndex: 0 })
})

it('warns if missing units on unspecialized transform', () => {
const consoleSpy = jest
.spyOn(global.console, 'warn')
.mockImplementation(() => {
// Silence the warning from the test output
})
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {
// Silence the warning from the test output
})

transformCss([['top', '1']])
expect(consoleSpy).toHaveBeenCalledWith(
Expand All @@ -20,7 +20,7 @@ it('warns if missing units on unspecialized transform', () => {
})

it('does not warn for unitless 0 length on unspecialized transform', () => {
const consoleSpy = jest.spyOn(global.console, 'warn')
const consoleSpy = vi.spyOn(console, 'warn')

transformCss([['top', '0']])
expect(consoleSpy).not.toHaveBeenCalled()
Expand All @@ -29,11 +29,9 @@ it('does not warn for unitless 0 length on unspecialized transform', () => {
})

it('warns if adding etraneous units on unspecialized transform', () => {
const consoleSpy = jest
.spyOn(global.console, 'warn')
.mockImplementation(() => {
// Silence the warning from the test output
})
const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {
// Silence the warning from the test output
})

transformCss([['opacity', '1px']])
expect(consoleSpy).toHaveBeenCalledWith(
Expand All @@ -44,7 +42,7 @@ it('warns if adding etraneous units on unspecialized transform', () => {
})

it('does not warn for unitless 0 length on unitless transform', () => {
const consoleSpy = jest.spyOn(global.console, 'warn')
const consoleSpy = vi.spyOn(console, 'warn')

transformCss([['opacity', '0']])
expect(consoleSpy).not.toHaveBeenCalled()
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/placeContent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms place content', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/shadowOffsets.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms shadow offsets', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/textDecoration.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms text-decoration into text-decoration- properties', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/textDecorationLine.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms text-decoration-line with underline line-through', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/textShadow.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('textShadow with all values', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/transform.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

it('transforms a single transform value with number', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/units.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { expect, it } from 'vitest'

import transformCss from '..'

// List of units from:
Expand Down
8 changes: 8 additions & 0 deletions vitest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
include: ['src/__tests__/**/*.js'],
watch: false,
},
})
Loading