Skip to content

Commit d028033

Browse files
authored
Merge pull request #28 from gluestack/fix/test-cases
Fix/test cases
2 parents e0add76 + 3ea5d6d commit d028033

File tree

9 files changed

+82
-28
lines changed

9 files changed

+82
-28
lines changed

.github/workflows/create-next-app-with-gluestack-ui.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ on:
99
branches:
1010
- main
1111
- development
12-
schedule:
13-
- cron: "0 */4 * * *"
1412

1513
jobs:
1614
test:
@@ -49,4 +47,4 @@ jobs:
4947
with:
5048
channel_id: C05HK6WEE56
5149
status: FAILED by @${{ github.actor}}
52-
color: danger
50+
color: danger
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
name: Create Next App with Gluestack UI
1+
name: Create Next App with Gluestack UI (isProduction | @latest)
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
104
schedule:
115
- cron: "0 */4 * * *"
126

@@ -24,12 +18,18 @@ jobs:
2418
- name: Install dependencies (prevent updates to lock file)
2519
working-directory: ${{ env.working-directory }}
2620
run: yarn
27-
- name: Building
21+
- name: Testing Production
2822
working-directory: ${{ env.working-directory }}
29-
run: yarn build
30-
- name: Testing
31-
working-directory: ${{ env.working-directory }}
32-
run: yarn test
23+
run: yarn test:production
24+
- name: Notify Success
25+
if: success()
26+
env:
27+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
28+
uses: voxmedia/github-action-slack-notify-build@v1
29+
with:
30+
channel_id: C05HK6WEE56
31+
status: SUCCESS by @${{ github.actor}}
32+
color: good
3333
- name: Notify Failure
3434
if: failure()
3535
env:
@@ -38,4 +38,4 @@ jobs:
3838
with:
3939
channel_id: C05HGN9LFV0
4040
status: FAILED by @${{ github.actor}}, Notify <@U047HGWBG>
41-
color: danger
41+
color: danger
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release create-next-app-with-gluestack-ui
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref || github.run_id }}
9+
10+
jobs:
11+
release:
12+
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged
13+
name: Publish version
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Repo
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Node.js v18.x
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: "18.x"
23+
24+
- name: Install dependencies
25+
run: |
26+
yarn
27+
yarn build
28+
29+
# - name: Create Release Pull Request or Publish to npm
30+
# id: changesets
31+
# uses: changesets/action@v1
32+
# with:
33+
# publish: yarn release
34+
# env:
35+
# GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
36+
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
38+
- name: Post to a Slack channel
39+
id: slack
40+
if: steps.changesets.outputs.published == 'true'
41+
uses: slackapi/slack-github-action@v1.23.0
42+
with:
43+
channel-id: C05H3MUMPN3
44+
# slack-message: "A new package was published in ${{ github.event.repository.name }}!\n${{ toJSON(steps.changesets.outputs.publishedPackages) }}"
45+
slack-message: "A new package was published in ${{ github.event.repository.name }}!
46+
color: good
47+
env:
48+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
*
2-
!.gitignore
1+
node_modules .next

packages/create-next-app-with-gluestack-ui/__tests__/integration/next-app-router.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const isProduction = process.argv.includes('--isProduction=true');
2121

2222
describe('Create Next.js app with app router:', () => {
2323
let appProcess;
24-
console.log(process.argv, 'hewheheh');
25-
2624
beforeAll(async () => {
2725
cleanUpPort(nextAppRootDirectory, NEXT_PORT);
2826
}, 200000);

packages/create-next-app-with-gluestack-ui/__tests__/integration/next-page-router.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ const options = '--page';
1616

1717
const NEXT_PORT = '3040';
1818
const nextAppUrl = `http://localhost:${NEXT_PORT}`;
19+
1920
const isProduction = process.argv.includes('--isProduction=true');
2021

2122
describe('Create Next.js app with page router:', () => {
2223
let appProcess;
23-
2424
beforeAll(async () => {
2525
cleanUpPort(nextAppRootDirectory, NEXT_PORT);
2626
}, 200000);

packages/create-next-app-with-gluestack-ui/__tests__/integration/utils.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { spawnSync } = require('child_process');
22
const { spawn } = require('child_process');
33
const { promisify } = require('util');
4-
4+
const path = require("path");
55
function cleanAppDirectory(nextAppRootDirectory, APP_NAME) {
66
spawnSync('rm -rf', [APP_NAME], {
77
cwd: nextAppRootDirectory,
@@ -20,12 +20,11 @@ function createProject(
2020
// Clone the my-next-app Git repository
2121

2222
const createrCommand = isProduction
23-
? `npx create-next-app-with-gluestack-ui@latest`
24-
: 'yarn dev';
25-
console.log('create app using cli with... ', createrCommand);
23+
? `npx create-next-app-with-gluestack-ui@latest` + ` ${APP_NAME}`
24+
: 'yarn dev ' + path.join("./", path.relative( './', nextAppRootDirectory), APP_NAME);
2625

2726
return new Promise((resolve, reject) => {
28-
const child = spawn(`${createrCommand} ${APP_NAME} ${options}`, {
27+
const child = spawn(`${createrCommand} ${options}`, {
2928
cwd: nextAppRootDirectory,
3029
shell: true,
3130
});
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<testsuites name="jest tests" tests="0" failures="0" errors="0" time="0.681">
2+
<testsuites name="jest tests" tests="4" failures="0" errors="0" time="106.606">
3+
<testsuite name="Create Next.js app with page router:" errors="0" failures="0" skipped="0" timestamp="2023-07-18T12:22:49" time="96.469" tests="2">
4+
<testcase classname="Create Next.js app with page router: Create a Next.js app with npx" name="Create Next.js app with page router: Create a Next.js app with npx" time="53.128">
5+
</testcase>
6+
<testcase classname="Create Next.js app with page router: Start and check if Next.js app is running" name="Create Next.js app with page router: Start and check if Next.js app is running" time="25.085">
7+
</testcase>
8+
</testsuite>
9+
<testsuite name="Create Next.js app with app router:" errors="0" failures="0" skipped="0" timestamp="2023-07-18T12:22:49" time="106.017" tests="2">
10+
<testcase classname="Create Next.js app with app router: Create a Next.js app with npx" name="Create Next.js app with app router: Create a Next.js app with npx" time="53.438">
11+
</testcase>
12+
<testcase classname="Create Next.js app with app router: Start and check if Next.js app is running" name="Create Next.js app with app router: Start and check if Next.js app is running" time="32.663">
13+
</testcase>
14+
</testsuite>
315
</testsuites>

packages/create-next-app-with-gluestack-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"prepare": "tsc",
2828
"test": "jest",
2929
"test:production": "jest --isProduction=true",
30-
"dev": "yarn build && node dist/index.js"
30+
"dev": "node dist/index.js"
3131
},
3232
"husky": {
3333
"hooks": {

0 commit comments

Comments
 (0)