From 26773daf05af3aa274f95fc3e506619d5be8566c Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 9 Feb 2023 09:58:37 -0500 Subject: [PATCH] [tests] Add tests for `examples` (#9403) These tests will run if one of the conditions is met: - any change to `./examples` - any changes to `./packages/frameworks` The test ensures that examples can build and deploy without errors. In a future PR, we could improve these tests to make requests to the test deployment (like we do for probes). --- .../__tests__/integration/angular.test.ts | 5 ++ examples/__tests__/integration/astro.test.ts | 5 ++ .../__tests__/integration/blitzjs.test.ts | 5 ++ examples/__tests__/integration/brunch.test.ts | 5 ++ .../integration/create-react-app.test.ts | 5 ++ .../integration/docusaurus-2.test.ts | 5 ++ .../__tests__/integration/docusaurus.test.ts | 5 ++ examples/__tests__/integration/dojo.test.ts | 5 ++ .../__tests__/integration/eleventy.test.ts | 5 ++ examples/__tests__/integration/ember.test.ts | 5 ++ examples/__tests__/integration/gatsby.test.ts | 5 ++ .../__tests__/integration/gridsome.test.ts | 5 ++ examples/__tests__/integration/hexo.test.ts | 5 ++ examples/__tests__/integration/hugo.test.ts | 5 ++ .../__tests__/integration/hydrogen.test.ts | 5 ++ .../integration/ionic-angular.test.ts | 5 ++ .../__tests__/integration/ionic-react.test.ts | 5 ++ examples/__tests__/integration/jekyll.test.ts | 5 ++ .../__tests__/integration/middleman.test.ts | 5 ++ examples/__tests__/integration/nextjs.test.ts | 5 ++ .../integration/node_modules.test.ts | 5 ++ examples/__tests__/integration/nuxtjs.test.ts | 5 ++ examples/__tests__/integration/parcel.test.ts | 5 ++ .../__tests__/integration/polymer.test.ts | 5 ++ examples/__tests__/integration/preact.test.ts | 5 ++ .../__tests__/integration/redwoodjs.test.ts | 5 ++ examples/__tests__/integration/remix.test.ts | 5 ++ examples/__tests__/integration/saber.test.ts | 5 ++ examples/__tests__/integration/sanity.test.ts | 5 ++ examples/__tests__/integration/sapper.test.ts | 5 ++ examples/__tests__/integration/scully.test.ts | 5 ++ .../__tests__/integration/solidstart.test.ts | 5 ++ .../__tests__/integration/stencil.test.ts | 5 ++ examples/__tests__/integration/svelte.test.ts | 5 ++ .../__tests__/integration/sveltekit-1.test.ts | 5 ++ .../__tests__/integration/sveltekit.test.ts | 5 ++ examples/__tests__/integration/umijs.test.ts | 5 ++ examples/__tests__/integration/vite.test.ts | 5 ++ .../__tests__/integration/vitepress.test.ts | 5 ++ examples/__tests__/integration/vue.test.ts | 5 ++ .../__tests__/integration/vuepress.test.ts | 5 ++ examples/__tests__/integration/zola.test.ts | 5 ++ examples/__tests__/test-utils.ts | 7 +++ examples/__tests__/unit/index.test.ts | 26 ++++++++ examples/blitzjs/package.json | 3 + examples/dojo/package.json | 3 + examples/ionic-angular/package.json | 3 + examples/ionic-react/package.json | 3 + examples/jest.config.js | 7 +++ examples/package.json | 14 +++++ examples/preact/package.json | 5 +- examples/saber/package.json | 3 + examples/sapper/package.json | 8 ++- examples/scully/package.json | 3 + examples/sveltekit/package.json | 4 +- examples/sveltekit/pnpm-lock.yaml | 63 ++++++++++--------- examples/tsconfig.json | 7 +++ examples/vue/package.json | 3 + pnpm-lock.yaml | 10 ++- pnpm-workspace.yaml | 1 + 60 files changed, 347 insertions(+), 36 deletions(-) create mode 100644 examples/__tests__/integration/angular.test.ts create mode 100644 examples/__tests__/integration/astro.test.ts create mode 100644 examples/__tests__/integration/blitzjs.test.ts create mode 100644 examples/__tests__/integration/brunch.test.ts create mode 100644 examples/__tests__/integration/create-react-app.test.ts create mode 100644 examples/__tests__/integration/docusaurus-2.test.ts create mode 100644 examples/__tests__/integration/docusaurus.test.ts create mode 100644 examples/__tests__/integration/dojo.test.ts create mode 100644 examples/__tests__/integration/eleventy.test.ts create mode 100644 examples/__tests__/integration/ember.test.ts create mode 100644 examples/__tests__/integration/gatsby.test.ts create mode 100644 examples/__tests__/integration/gridsome.test.ts create mode 100644 examples/__tests__/integration/hexo.test.ts create mode 100644 examples/__tests__/integration/hugo.test.ts create mode 100644 examples/__tests__/integration/hydrogen.test.ts create mode 100644 examples/__tests__/integration/ionic-angular.test.ts create mode 100644 examples/__tests__/integration/ionic-react.test.ts create mode 100644 examples/__tests__/integration/jekyll.test.ts create mode 100644 examples/__tests__/integration/middleman.test.ts create mode 100644 examples/__tests__/integration/nextjs.test.ts create mode 100644 examples/__tests__/integration/node_modules.test.ts create mode 100644 examples/__tests__/integration/nuxtjs.test.ts create mode 100644 examples/__tests__/integration/parcel.test.ts create mode 100644 examples/__tests__/integration/polymer.test.ts create mode 100644 examples/__tests__/integration/preact.test.ts create mode 100644 examples/__tests__/integration/redwoodjs.test.ts create mode 100644 examples/__tests__/integration/remix.test.ts create mode 100644 examples/__tests__/integration/saber.test.ts create mode 100644 examples/__tests__/integration/sanity.test.ts create mode 100644 examples/__tests__/integration/sapper.test.ts create mode 100644 examples/__tests__/integration/scully.test.ts create mode 100644 examples/__tests__/integration/solidstart.test.ts create mode 100644 examples/__tests__/integration/stencil.test.ts create mode 100644 examples/__tests__/integration/svelte.test.ts create mode 100644 examples/__tests__/integration/sveltekit-1.test.ts create mode 100644 examples/__tests__/integration/sveltekit.test.ts create mode 100644 examples/__tests__/integration/umijs.test.ts create mode 100644 examples/__tests__/integration/vite.test.ts create mode 100644 examples/__tests__/integration/vitepress.test.ts create mode 100644 examples/__tests__/integration/vue.test.ts create mode 100644 examples/__tests__/integration/vuepress.test.ts create mode 100644 examples/__tests__/integration/zola.test.ts create mode 100644 examples/__tests__/test-utils.ts create mode 100644 examples/__tests__/unit/index.test.ts create mode 100644 examples/jest.config.js create mode 100644 examples/package.json create mode 100644 examples/tsconfig.json diff --git a/examples/__tests__/integration/angular.test.ts b/examples/__tests__/integration/angular.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/angular.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/astro.test.ts b/examples/__tests__/integration/astro.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/astro.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/blitzjs.test.ts b/examples/__tests__/integration/blitzjs.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/blitzjs.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/brunch.test.ts b/examples/__tests__/integration/brunch.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/brunch.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/create-react-app.test.ts b/examples/__tests__/integration/create-react-app.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/create-react-app.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/docusaurus-2.test.ts b/examples/__tests__/integration/docusaurus-2.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/docusaurus-2.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/docusaurus.test.ts b/examples/__tests__/integration/docusaurus.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/docusaurus.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/dojo.test.ts b/examples/__tests__/integration/dojo.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/dojo.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/eleventy.test.ts b/examples/__tests__/integration/eleventy.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/eleventy.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/ember.test.ts b/examples/__tests__/integration/ember.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/ember.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/gatsby.test.ts b/examples/__tests__/integration/gatsby.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/gatsby.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/gridsome.test.ts b/examples/__tests__/integration/gridsome.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/gridsome.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/hexo.test.ts b/examples/__tests__/integration/hexo.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/hexo.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/hugo.test.ts b/examples/__tests__/integration/hugo.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/hugo.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/hydrogen.test.ts b/examples/__tests__/integration/hydrogen.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/hydrogen.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/ionic-angular.test.ts b/examples/__tests__/integration/ionic-angular.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/ionic-angular.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/ionic-react.test.ts b/examples/__tests__/integration/ionic-react.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/ionic-react.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/jekyll.test.ts b/examples/__tests__/integration/jekyll.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/jekyll.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/middleman.test.ts b/examples/__tests__/integration/middleman.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/middleman.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/nextjs.test.ts b/examples/__tests__/integration/nextjs.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/nextjs.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/node_modules.test.ts b/examples/__tests__/integration/node_modules.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/node_modules.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/nuxtjs.test.ts b/examples/__tests__/integration/nuxtjs.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/nuxtjs.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/parcel.test.ts b/examples/__tests__/integration/parcel.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/parcel.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/polymer.test.ts b/examples/__tests__/integration/polymer.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/polymer.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/preact.test.ts b/examples/__tests__/integration/preact.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/preact.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/redwoodjs.test.ts b/examples/__tests__/integration/redwoodjs.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/redwoodjs.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/remix.test.ts b/examples/__tests__/integration/remix.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/remix.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/saber.test.ts b/examples/__tests__/integration/saber.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/saber.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/sanity.test.ts b/examples/__tests__/integration/sanity.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/sanity.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/sapper.test.ts b/examples/__tests__/integration/sapper.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/sapper.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/scully.test.ts b/examples/__tests__/integration/scully.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/scully.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/solidstart.test.ts b/examples/__tests__/integration/solidstart.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/solidstart.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/stencil.test.ts b/examples/__tests__/integration/stencil.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/stencil.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/svelte.test.ts b/examples/__tests__/integration/svelte.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/svelte.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/sveltekit-1.test.ts b/examples/__tests__/integration/sveltekit-1.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/sveltekit-1.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/sveltekit.test.ts b/examples/__tests__/integration/sveltekit.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/sveltekit.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/umijs.test.ts b/examples/__tests__/integration/umijs.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/umijs.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/vite.test.ts b/examples/__tests__/integration/vite.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/vite.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/vitepress.test.ts b/examples/__tests__/integration/vitepress.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/vitepress.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/vue.test.ts b/examples/__tests__/integration/vue.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/vue.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/vuepress.test.ts b/examples/__tests__/integration/vuepress.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/vuepress.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/integration/zola.test.ts b/examples/__tests__/integration/zola.test.ts new file mode 100644 index 000000000..776700a3f --- /dev/null +++ b/examples/__tests__/integration/zola.test.ts @@ -0,0 +1,5 @@ +import { deployExample } from '../test-utils'; +it('should deploy', async () => { + await deployExample(__filename); +}); + \ No newline at end of file diff --git a/examples/__tests__/test-utils.ts b/examples/__tests__/test-utils.ts new file mode 100644 index 000000000..40175bd68 --- /dev/null +++ b/examples/__tests__/test-utils.ts @@ -0,0 +1,7 @@ +import { basename, join } from 'path'; +import { testDeployment } from '../../test/lib/deployment/test-deployment.js'; + +export async function deployExample(filename: string) { + const example = basename(filename).replace(/\.test\.ts$/, ''); + await testDeployment(join(filename, '..', '..', '..', example)); +} diff --git a/examples/__tests__/unit/index.test.ts b/examples/__tests__/unit/index.test.ts new file mode 100644 index 000000000..d53e51924 --- /dev/null +++ b/examples/__tests__/unit/index.test.ts @@ -0,0 +1,26 @@ +import { existsSync, lstatSync, readdirSync } from 'fs'; +import { join } from 'path'; + +function getExamples() { + const dirname = join(__dirname, '..', '..'); + const examples = readdirSync(dirname) + .map(example => + ({ + exampleName: example, + examplePath: join(dirname, example), + testPath: join(dirname, '__tests__', 'integration', `${example}.test.ts`), + }) + ) + .filter(o => + !o.exampleName.startsWith('.') && + !o.exampleName.startsWith('_') && + lstatSync(o.examplePath).isDirectory() + ); + return examples; +} + +describe('should have test for each example', () => { + it.each(getExamples())('should exist $exampleName', async ({testPath}) => { + expect(existsSync(testPath)).toBeTruthy(); + }); +}); diff --git a/examples/blitzjs/package.json b/examples/blitzjs/package.json index 4c5bacbaf..5ffcb5688 100644 --- a/examples/blitzjs/package.json +++ b/examples/blitzjs/package.json @@ -8,6 +8,9 @@ "lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .", "test": "echo \"No tests yet\"" }, + "engines": { + "node": "16.x" + }, "browserslist": [ "defaults" ], diff --git a/examples/dojo/package.json b/examples/dojo/package.json index 5c68dd700..6a00acf56 100644 --- a/examples/dojo/package.json +++ b/examples/dojo/package.json @@ -10,6 +10,9 @@ "test:functional": "dojo build --mode functional && dojo test --functional --config local", "test:all": "dojo build --mode unit && dojo build --mode functional && dojo test --all --config local" }, + "engines": { + "node": "16.x" + }, "dependencies": { "@dojo/framework": "^6.0.0", "@dojo/themes": "^6.0.0", diff --git a/examples/ionic-angular/package.json b/examples/ionic-angular/package.json index a6640d46d..07f91f5cd 100644 --- a/examples/ionic-angular/package.json +++ b/examples/ionic-angular/package.json @@ -18,6 +18,9 @@ "url": "https://github.com/ionic-team/ionic-conference-app.git" }, "private": true, + "engines": { + "node": "16.x" + }, "dependencies": { "@angular/common": "^8.2.14", "@angular/core": "^8.2.14", diff --git a/examples/ionic-react/package.json b/examples/ionic-react/package.json index e69b29924..9060c529b 100644 --- a/examples/ionic-react/package.json +++ b/examples/ionic-react/package.json @@ -2,6 +2,9 @@ "name": "ionic-react", "version": "0.0.1", "private": true, + "engines": { + "node": "16.x" + }, "dependencies": { "@ionic/react": "^4.11.0", "@ionic/react-router": "^4.11.0", diff --git a/examples/jest.config.js b/examples/jest.config.js new file mode 100644 index 000000000..006b46d1b --- /dev/null +++ b/examples/jest.config.js @@ -0,0 +1,7 @@ +/** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', + testMatch: ['/__tests__/**/*.test.ts'], + testTimeout: 5 * 60 * 1000, +}; diff --git a/examples/package.json b/examples/package.json new file mode 100644 index 000000000..a6c3e6152 --- /dev/null +++ b/examples/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "name": "examples", + "description": "Each subdirectory is an example boilerplate for a framework. This package.json only exists for testing purposes.", + "scripts": { + "test-unit": "pnpm test __tests__/unit/", + "test-integration-once": "pnpm test __tests__/integration/", + "test": "jest --env node --verbose --runInBand --bail" + }, + "devDependencies": { + "@types/jest": "27.4.1", + "@vercel/frameworks": "1.3.0" + } +} diff --git a/examples/preact/package.json b/examples/preact/package.json index d5eb59e10..5d126e79f 100644 --- a/examples/preact/package.json +++ b/examples/preact/package.json @@ -7,6 +7,9 @@ "lint": "eslint src", "test": "jest" }, + "engines": { + "node": "16.x" + }, "eslintConfig": { "extends": "preact", "ignorePatterns": [ @@ -35,4 +38,4 @@ "/tests/__mocks__/setupTests.js" ] } -} \ No newline at end of file +} diff --git a/examples/saber/package.json b/examples/saber/package.json index f4448e980..712cf4446 100644 --- a/examples/saber/package.json +++ b/examples/saber/package.json @@ -4,6 +4,9 @@ "dev": "saber", "build": "saber build" }, + "engines": { + "node": "16.x" + }, "devDependencies": { "saber": "latest", "saber-theme-minima": "latest", diff --git a/examples/sapper/package.json b/examples/sapper/package.json index 5845115a6..f76492262 100644 --- a/examples/sapper/package.json +++ b/examples/sapper/package.json @@ -1,7 +1,6 @@ { - "name": "TODO", - "description": "TODO", - "version": "0.0.1", + "name": "sapper", + "private": true, "scripts": { "start": "sapper dev", "dev": "sapper dev --port $PORT", @@ -10,6 +9,9 @@ "cy:open": "cypress open", "test": "run-p --race dev cy:run" }, + "engines": { + "node": "16.x" + }, "dependencies": { "compression": "^1.7.1", "polka": "next", diff --git a/examples/scully/package.json b/examples/scully/package.json index e978aa611..a78f7a938 100644 --- a/examples/scully/package.json +++ b/examples/scully/package.json @@ -10,6 +10,9 @@ "scully": "scully" }, "private": true, + "engines": { + "node": "16.x" + }, "dependencies": { "@angular/animations": "~9.0.0-rc.7", "@angular/common": "~9.0.0-rc.7", diff --git a/examples/sveltekit/package.json b/examples/sveltekit/package.json index 61b70af91..be53a29bf 100644 --- a/examples/sveltekit/package.json +++ b/examples/sveltekit/package.json @@ -11,8 +11,8 @@ "format": "prettier --write ." }, "devDependencies": { - "@sveltejs/adapter-auto": "next", - "@sveltejs/kit": "1.0.0-next.589", + "@sveltejs/adapter-auto": "1.0.0-next.65", + "@sveltejs/kit": "1.0.0-next.428", "@types/cookie": "^0.5.1", "prettier": "^2.6.2", "prettier-plugin-svelte": "^2.7.0", diff --git a/examples/sveltekit/pnpm-lock.yaml b/examples/sveltekit/pnpm-lock.yaml index 1611d87ec..413992a7a 100644 --- a/examples/sveltekit/pnpm-lock.yaml +++ b/examples/sveltekit/pnpm-lock.yaml @@ -2,8 +2,8 @@ lockfileVersion: 5.4 specifiers: '@fontsource/fira-mono': ^4.5.0 - '@sveltejs/adapter-auto': next - '@sveltejs/kit': next + '@sveltejs/adapter-auto': 1.0.0-next.65 + '@sveltejs/kit': 1.0.0-next.428 '@types/cookie': ^0.5.1 cookie: ^0.4.1 prettier: ^2.6.2 @@ -32,8 +32,8 @@ devDependencies: packages: - /@cloudflare/workers-types/3.14.1: - resolution: {integrity: sha512-B1/plF62pt+H2IJHvApK8fdOJAVsvojvacuac8x8s+JIyqbropMyqNqHTKLm3YD8ZFLGwYeFTudU+PQ7vGvBdA==} + /@cloudflare/workers-types/3.19.0: + resolution: {integrity: sha512-0FRcsz7Ea3jT+gc5gKPIYciykm1bbAaTpygdzpCwGt0RL+V83zWnYN30NWDW4rIHj/FHtz+MIuBKS61C8l7AzQ==} dev: true /@esbuild/linux-loong64/0.14.54: @@ -69,19 +69,19 @@ packages: '@jridgewell/sourcemap-codec': 1.4.14 dev: true - /@mapbox/node-pre-gyp/1.0.9: - resolution: {integrity: sha512-aDF3S3rK9Q2gey/WAttUlISduDItz5BU3306M9Eyv6/oS40aMprnopshtlKTykxRNIBEZuRMaZAnbrQ4QtKGyw==} + /@mapbox/node-pre-gyp/1.0.10: + resolution: {integrity: sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==} hasBin: true dependencies: detect-libc: 2.0.1 https-proxy-agent: 5.0.1 make-dir: 3.1.0 - node-fetch: 2.6.7 + node-fetch: 2.6.9 nopt: 5.0.0 npmlog: 5.0.1 rimraf: 3.0.2 - semver: 7.3.7 - tar: 6.1.11 + semver: 7.3.8 + tar: 6.1.13 transitivePeerDependencies: - encoding - supports-color @@ -134,7 +134,7 @@ packages: /@sveltejs/adapter-cloudflare/1.0.0-next.31: resolution: {integrity: sha512-HhEFZP72GJ8AZGgFECKIiayDcLaAWi65pI0AnBfiNhCifYSlH/mPNWNVD4AWRDnXnH6XU+FLwhGDnIDwytTyYg==} dependencies: - '@cloudflare/workers-types': 3.14.1 + '@cloudflare/workers-types': 3.19.0 esbuild: 0.14.54 worktop: 0.8.0-next.14 dev: true @@ -231,15 +231,15 @@ packages: resolution: {integrity: sha512-hFCAETfI5cG8l5iAiLhMC2bReC5K7SIybzrxGorv+eGspIbIFsVw7Vg85GovXm/LxA08pIDrAlrhR6GN36XB/Q==} hasBin: true dependencies: - '@mapbox/node-pre-gyp': 1.0.9 - acorn: 8.8.0 + '@mapbox/node-pre-gyp': 1.0.10 + acorn: 8.8.2 async-sema: 3.1.1 bindings: 1.5.0 estree-walker: 2.0.2 glob: 7.2.3 graceful-fs: 4.2.10 micromatch: 4.0.5 - node-gyp-build: 4.5.0 + node-gyp-build: 4.6.0 resolve-from: 5.0.0 rollup-pluginutils: 2.8.2 transitivePeerDependencies: @@ -251,8 +251,8 @@ packages: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} dev: true - /acorn/8.8.0: - resolution: {integrity: sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==} + /acorn/8.8.2: + resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -688,7 +688,7 @@ packages: resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} engines: {node: '>= 8'} dependencies: - minipass: 3.3.4 + minipass: 3.3.6 dev: true /fs.realpath/1.0.0: @@ -893,18 +893,23 @@ packages: resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==} dev: true - /minipass/3.3.4: - resolution: {integrity: sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw==} + /minipass/3.3.6: + resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} engines: {node: '>=8'} dependencies: yallist: 4.0.0 dev: true + /minipass/4.0.3: + resolution: {integrity: sha512-OW2r4sQ0sI+z5ckEt5c1Tri4xTgZwYDxpE54eqWlQloQRoWtXjqt9udJ5Z4dSv7wK+nfFI7FRXyCpBSft+gpFw==} + engines: {node: '>=8'} + dev: true + /minizlib/2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} dependencies: - minipass: 3.3.4 + minipass: 3.3.6 yallist: 4.0.0 dev: true @@ -946,8 +951,8 @@ packages: engines: {node: '>=10.5.0'} dev: true - /node-fetch/2.6.7: - resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} + /node-fetch/2.6.9: + resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==} engines: {node: 4.x || >=6.0.0} peerDependencies: encoding: ^0.1.0 @@ -967,8 +972,8 @@ packages: formdata-polyfill: 4.0.10 dev: true - /node-gyp-build/4.5.0: - resolution: {integrity: sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==} + /node-gyp-build/4.6.0: + resolution: {integrity: sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==} hasBin: true dev: true @@ -1163,8 +1168,8 @@ packages: hasBin: true dev: true - /semver/7.3.7: - resolution: {integrity: sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==} + /semver/7.3.8: + resolution: {integrity: sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==} engines: {node: '>=10'} hasBin: true dependencies: @@ -1338,13 +1343,13 @@ packages: engines: {node: '>= 8'} dev: true - /tar/6.1.11: - resolution: {integrity: sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==} - engines: {node: '>= 10'} + /tar/6.1.13: + resolution: {integrity: sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw==} + engines: {node: '>=10'} dependencies: chownr: 2.0.0 fs-minipass: 2.1.0 - minipass: 3.3.4 + minipass: 4.0.3 minizlib: 2.1.2 mkdirp: 1.0.4 yallist: 4.0.0 diff --git a/examples/tsconfig.json b/examples/tsconfig.json new file mode 100644 index 000000000..5decf25c2 --- /dev/null +++ b/examples/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "target": "esnext", + "module": "commonjs" + } +} diff --git a/examples/vue/package.json b/examples/vue/package.json index 06b532a69..760177f65 100644 --- a/examples/vue/package.json +++ b/examples/vue/package.json @@ -5,6 +5,9 @@ "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, + "engines": { + "node": "16.x" + }, "dependencies": { "core-js": "^3.6.5", "vue": "^3.0.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 82dd7ea58..169f9417f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,6 +84,14 @@ importers: '@vercel/node': link:../packages/node typescript: 4.3.4 + examples: + specifiers: + '@types/jest': 27.4.1 + '@vercel/frameworks': 1.3.0 + devDependencies: + '@types/jest': 27.4.1 + '@vercel/frameworks': link:../packages/frameworks + packages/build-utils: specifiers: '@iarna/toml': 2.2.3 @@ -6053,7 +6061,7 @@ packages: /@types/jest-expect-message/1.0.3: resolution: {integrity: sha512-sp70Lc8POkOcXHEcLERpX/7B/BtQiqIYz3AvC9ZMNKSaiDttr8hKvz9DljIn7N6WJi3ioVoTtB1utDAX46oPlg==} dependencies: - '@types/jest': 27.4.1 + '@types/jest': 29.2.1 dev: true /@types/jest/27.4.1: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index efd79ec4e..d1f324d88 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,4 @@ packages: - 'packages/*' - 'api' + - 'examples'