Skip to content

Commit

Permalink
fix: integration test (#2841)
Browse files Browse the repository at this point in the history
* chore: added type checking for `create-fuels`

* fix: integration test

* docs: updated missing flags for `create fuels` commands

* chore: changeset

* chore: enable integration test

* chore: enable integration for all

* chore: debugging out the web server

* chore: removed output from playwright install

* chore: debug install

* chore: re-added null logging

* chore: re-added conditionals for integration test workflow
  • Loading branch information
petertonysmith94 committed Jul 30, 2024
1 parent 950abf9 commit 8865f15
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .changeset/short-pens-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
4 changes: 1 addition & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
integration:
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.ref_name == 'master' || github.head_ref == 'changeset-release/master'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -66,7 +67,6 @@ jobs:
run: sh ./scripts/tests-ui.sh

- name: Wait for release to succeed
if: github.ref_name == 'master' || github.head_ref == 'changeset-release/master'
uses: lewagon/[email protected]
with:
ref: "refs/heads/master"
Expand All @@ -75,13 +75,11 @@ jobs:
wait-interval: 30

- name: Run tests (with published version)
if: github.ref_name == 'master' || github.head_ref == 'changeset-release/master'
run: pnpm test:integration
env:
PUBLISHED_NPM_TAG: next

- name: Run UI tests (with published version)
if: github.ref_name == 'master' || github.head_ref == 'changeset-release/master'
run: sh ./scripts/tests-ui-integration.sh
env:
PUBLISHED_NPM_TAG: next
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/src/guide/creating-a-fuel-dapp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ The first step is to run the command:
::: code-group

```sh-vue [npm]
npm create fuels@{{fuels}}
npm create fuels@{{fuels}} -- --npm
```

```sh-vue [pnpm]
pnpm create fuels@{{fuels}}
pnpm create fuels@{{fuels}} --pnpm
```

```sh-vue [bun]
bunx --bun create-fuels@{{fuels}}
bunx --bun create-fuels@{{fuels}} --bun
```

:::
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/src/guide/creating-a-fuel-dapp/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ The `npm create fuels` command has several command-line options that you can use
::: code-group

```sh-vue [pnpm]
pnpm create fuels@{{fuels}} [project-name] [options]
pnpm create fuels@{{fuels}} --pnpm [project-name] [options]
```

```sh-vue [npm]
npm create fuels@{{fuels}} -- [project-name] [options]
npm create fuels@{{fuels}} -- --npm [project-name] [options]
```

```sh-vue [bun]
bunx --bun create-fuels@{{fuels}} [project-name] [options]
bunx --bun create-fuels@{{fuels}} --bun [project-name] [options]
```

:::
Expand Down
2 changes: 1 addition & 1 deletion packages/create-fuels/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"license": "Apache-2.0",
"scripts": {
"build": "tsup",
"build": "tsup && tsc --noEmit",
"prepublishOnly": "tsx ./scripts/prepublish.ts"
},
"dependencies": {
Expand Down
10 changes: 5 additions & 5 deletions packages/create-fuels/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('`create fuels` package integrity', () => {
});

afterEach(() => {
resetFilesystem(paths.root);
resetFilesystem(paths.projectRoot);
});

it.each(packageManagerCreateCommands)(
Expand All @@ -54,8 +54,8 @@ describe('`create fuels` package integrity', () => {
`"fuels": "[0-9]+.[0-9]+.[0-9]+-${PUBLISHED_NPM_TAG}-[0-9]+"`
);

const args = generateArgs(paths.root, packageManager).join(' ');
const expectedTemplateFiles = await getAllFiles(paths.sourceTemplate).then((files) =>
const args = generateArgs(paths.projectRoot, packageManager).join(' ');
const expectedTemplateFiles = await getAllFiles(paths.templateSource).then((files) =>
filterOriginalTemplateFiles(files).filter(filterForcBuildFiles)
);

Expand All @@ -66,9 +66,9 @@ describe('`create fuels` package integrity', () => {
);

expect(createFuelsError).toBeUndefined();
const actualTemplateFiles = await getAllFiles(paths.root);
const actualTemplateFiles = await getAllFiles(paths.projectRoot);
expect(actualTemplateFiles.sort()).toEqual(expectedTemplateFiles.sort());
const packageJson = readFileSync(paths.packageJson, 'utf-8');
const packageJson = readFileSync(paths.projectPackageJson, 'utf-8');
expect(packageJson).toEqual(expect.stringMatching(expectedPackageJsonInstall));
},
{ timeout: 30000 }
Expand Down
4 changes: 2 additions & 2 deletions scripts/tests-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ PROJECT_DIR="${PROJECT_DIR-"$ROOT_DIR/templates/nextjs"}"
cd $PROJECT_DIR && pnpm run fuels:dev > /dev/null 2>&1 &
sleep 5

cd $PROJECT_DIR && pnpm run dev > /dev/null 2>&1 &
cd $PROJECT_DIR && pnpm run dev > /dev/null 2>&1 &
sleep 5

cd $PLAYWRIGHT_DIR
pnpm exec playwright install --with-deps
pnpm exec playwright install --with-deps > /dev/null 2>&1
pnpm exec playwright test

pkill next-server
Expand Down

0 comments on commit 8865f15

Please sign in to comment.