Skip to content

Commit

Permalink
refactor: modify migrated integration test format to be a guide for t…
Browse files Browse the repository at this point in the history
…he upcoming works (#463)

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
  • Loading branch information
devjiwonchoi and huozhi committed Feb 18, 2024
1 parent bbfa097 commit c4fd618
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 56 deletions.
4 changes: 2 additions & 2 deletions test/integration/basic-jsx/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest, assertContainFiles } from '../utils'

describe('integration', () => {
test(`basic-jsx`, async () => {
describe('integration basic-jsx', () => {
it('should work with basic JSX format', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
1 change: 1 addition & 0 deletions test/integration/bin/cts/fixtures/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
10 changes: 3 additions & 7 deletions test/integration/bin/cts/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { readFile } from 'fs/promises'
import { createIntegrationTest, deleteFile, existsFile } from '../../utils'
import { createIntegrationTest, existsFile } from '../../utils'

afterEach(async () => {
await deleteFile(`${__dirname}/fixtures/tsconfig.json`)
})

describe('integration', () => {
test(`bin/cts`, async () => {
describe('integration bin/cts', () => {
it('should work with bin as .cts extension', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
1 change: 1 addition & 0 deletions test/integration/bin/multi-path/fixtures/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
10 changes: 3 additions & 7 deletions test/integration/bin/multi-path/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { readFile } from 'fs/promises'
import { createIntegrationTest, existsFile, deleteFile } from '../../utils'
import { createIntegrationTest, existsFile } from '../../utils'

afterEach(async () => {
await deleteFile(`${__dirname}/fixtures/tsconfig.json`)
})

describe('integration', () => {
test(`bin/multi-path`, async () => {
describe('integration bin/multi-path', () => {
it('should work with bin as multi path', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
1 change: 1 addition & 0 deletions test/integration/bin/single-path/fixtures/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
14 changes: 3 additions & 11 deletions test/integration/bin/single-path/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { readFile } from 'fs/promises'
import {
createIntegrationTest,
assertContainFiles,
deleteFile,
} from '../../utils'
import { createIntegrationTest, assertContainFiles } from '../../utils'

afterEach(async () => {
await deleteFile(`${__dirname}/fixtures/tsconfig.json`)
})

describe('integration', () => {
test(`bin/single-path`, async () => {
describe('integration bin/single-path', () => {
it('should work with bin as single path', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/cjs-pkg-esm-main-field/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest } from '../utils'

describe('integration', () => {
test(`cjs-pkg-esm-main-field`, async () => {
describe('integration cjs-pkg-esm-main-field', () => {
it('should warn if main field with .mjs extension in CJS package', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/default-node-mjs/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { readFile } from 'fs/promises'
import { createIntegrationTest, existsFile } from '../utils'

describe('integration', () => {
test(`default-node-mjs`, async () => {
describe('integration default-node-mjs', () => {
it('should work with .mjs extension', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
1 change: 1 addition & 0 deletions test/integration/dev-prod-convention/fixtures/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
10 changes: 3 additions & 7 deletions test/integration/dev-prod-convention/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { createIntegrationTest, assertFilesContent, deleteFile } from '../utils'
import { createIntegrationTest, assertFilesContent } from '../utils'

afterEach(async () => {
await deleteFile(`${__dirname}/fixtures/tsconfig.json`)
})

describe('integration', () => {
test(`dev-prod-convention`, async () => {
describe('integration dev-prod-convention', () => {
it('should work on optimize conventions dev and prod', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/duplicate-entry/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest, assertContainFiles } from '../utils'

describe('integration', () => {
test(`duplicate-entry`, async () => {
describe('integration duplicate-entry', () => {
it('should deduplicate entries', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/edge-variable/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest, assertFilesContent } from '../utils'

describe('integration', () => {
test(`edge-variable`, async () => {
describe('integration edge-variable', () => {
it('should work with edge export condition', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/entry-index-index/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest, assertFilesContent } from '../utils'

describe('integration', () => {
test(`entry-index-index`, async () => {
describe('integration entry-index-index', () => {
it('should work with index file inside index directory', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/esm-pkg-cjs-main-field/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest, assertContainFiles } from '../utils'

describe('integration', () => {
test(`esm-pkg-cjs-main-field`, async () => {
describe('integration esm-pkg-cjs-main-field', () => {
it('should work with ESM package with CJS main field ', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/esm-shims/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest, assertFilesContent } from '../utils'

describe('integration', () => {
test(`esm-shims`, async () => {
describe('integration esm-shims', () => {
it('should work with ESM shims', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/externals/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { readFile } from 'fs/promises'
import { createIntegrationTest } from '../utils'

describe('integration', () => {
test(`externals`, async () => {
describe('integration externals', () => {
it('should handle externals', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/invalid-exports-cjs/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest } from '../utils'

describe('integration', () => {
test(`invalid-exports-cjs`, async () => {
describe('integration invalid-exports-cjs', () => {
it('should warn on invalid exports as CJS', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/invalid-exports-esm/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest } from '../utils'

describe('integration', () => {
test(`invalid-exports-esm`, async () => {
describe('integration invalid-exports-esm', () => {
it('should warn on invalid exports as ESM', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/js-only/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createIntegrationTest, existsFile } from '../utils'

describe('integration', () => {
test(`js-only`, async () => {
describe('integration js-only', () => {
it('should work with js only project', async () => {
await createIntegrationTest(
{
directory: __dirname,
Expand Down

0 comments on commit c4fd618

Please sign in to comment.