Skip to content

Commit

Permalink
chore(infra/e2e): @e2e/helper rather than #imports (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter authored Aug 5, 2024
1 parent f008641 commit 6ee69df
Show file tree
Hide file tree
Showing 28 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion e2e/cases/alias/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('source.alias', async () => {
const fixturePath = __dirname;
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/alias/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleCjsConfig, generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/autoExtension/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { extname, join } from 'node:path';
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('autoExtension generate .mjs in build artifacts with esm format when type is commonjs', async () => {
const fixturePath = join(__dirname, 'type-commonjs');
Expand Down
5 changes: 1 addition & 4 deletions e2e/cases/autoExtension/type-commonjs/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import {
generateBundleCjsConfig,
generateBundleEsmConfig,
} from '../../../scripts/shared';

export default defineConfig({
lib: [
Expand Down
5 changes: 1 addition & 4 deletions e2e/cases/autoExtension/type-module/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import {
generateBundleCjsConfig,
generateBundleEsmConfig,
} from '../../../scripts/shared';

export default defineConfig({
lib: [
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/bundle-false/basic/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleCjsConfig, generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/bundle-false/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('bundle: false', async () => {
const fixturePath = join(__dirname, 'basic');
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/cli/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { execSync } from 'node:child_process';
import path from 'node:path';
import { globContentJSON } from '@e2e/helper';
import fse from 'fs-extra';
import { expect, test } from 'vitest';
import { globContentJSON } from '#helper';

test.todo('build command', async () => {});

Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/cli/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [generateBundleEsmConfig(__dirname)],
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/define/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('source.define', async () => {
const fixturePath = __dirname;
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/define/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleCjsConfig, generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle-false/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleCjsConfig, generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('dts when bundle: false', async () => {
const fixturePath = join(__dirname, 'bundle-false');
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/externals/browser/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('should fail to build when `output.target` is not "node"', async () => {
const fixturePath = join(__dirname);
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/externals/browser/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleCjsConfig, generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/externals/node/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('auto externalize Node.js built-in modules when `output.target` is "node"', async () => {
const fixturePath = join(__dirname);
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/externals/node/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleCjsConfig, generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/syntax/config/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('should downgrade class private method by default', async () => {
const fixturePath = __dirname;
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/syntax/config/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleCjsConfig, generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/syntax/default/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { buildAndGetResults } from '@e2e/helper';
import { expect, test } from 'vitest';
import { buildAndGetResults } from '#shared';

test('should downgrade class private method by default', async () => {
const fixturePath = __dirname;
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/syntax/default/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
import { defineConfig } from '@rslib/core';
import { generateBundleCjsConfig, generateBundleEsmConfig } from '#shared';

export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
Expand Down
5 changes: 1 addition & 4 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
"name": "@rslib/e2e",
"private": true,
"type": "module",
"imports": {
"#helper": "./scripts/helper.ts",
"#shared": "./scripts/shared.ts"
},
"scripts": {
"test": "playwright test --pass-with-no-tests"
},
"dependencies": {
"react": "^18.3.1"
},
"devDependencies": {
"@e2e/helper": "workspace:*",
"@playwright/test": "1.43.1",
"@rsbuild/core": "1.0.1-beta.8",
"@rslib/core": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion e2e/scripts/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fg, {
} from 'fast-glob';
import fse from 'fs-extra';

export const getFiles = async (pattern: string) => {};
export const getFiles = async (_pattern: string) => {};

// fast-glob only accepts posix path
// https://github.com/mrmlnc/fast-glob#convertpathtopatternpath
Expand Down
2 changes: 2 additions & 0 deletions e2e/scripts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './helper';
export * from './shared';
1 change: 0 additions & 1 deletion e2e/scripts/main.ts

This file was deleted.

7 changes: 7 additions & 0 deletions e2e/scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@e2e/helper",
"version": "1.0.0",
"private": true,
"main": "index.ts",
"types": "index.ts"
}
8 changes: 2 additions & 6 deletions e2e/scripts/shared.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { join } from 'node:path';
import {
type InspectConfigResult,
type Rspack,
mergeRsbuildConfig as mergeConfig,
} from '@rsbuild/core';
import type { LibConfig, RslibConfig } from '@rslib/core';
import { globContentJSON } from '#helper';
import { build } from '../../packages/core/src/build';
import {
composeCreateRsbuildConfig,
loadConfig,
} from '../../packages/core/src/config';
import { loadConfig } from '../../packages/core/src/config';
import { globContentJSON } from './helper';

export function generateBundleEsmConfig(
cwd: string,
Expand Down
5 changes: 5 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6ee69df

Please sign in to comment.