Skip to content

Commit

Permalink
Merge pull request #301 from NullVoxPopuli/fix-issue-297
Browse files Browse the repository at this point in the history
reproduce and fix issue #297
  • Loading branch information
NullVoxPopuli authored Dec 5, 2021
2 parents 9e7c406 + 91c8b20 commit 680df8d
Show file tree
Hide file tree
Showing 34 changed files with 858 additions and 8 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,23 @@ jobs:
# - run: yarn tsc --build
# - run: npm run prepack
# - run: npm exec tsc --build

types_concurrency_1:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
name: "Type Correctness (w/ concurrency@v1)"
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [install_dependencies]

steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: |
cd ember-resources
yarn build:types
cd ../testing/ember-concurrency-v1/
tsc --build
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface TaskInstance<Return = unknown> extends Promise<Return> {
readonly isFinished: boolean;
readonly isRunning: boolean;
readonly isDropped: boolean;
cancel(reason?: string): Promise<void>;
cancel(reason?: string): void | Promise<void>;
}

// @private
Expand Down
19 changes: 19 additions & 0 deletions testing/ember-concurrency-v1/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions testing/ember-concurrency-v1/.ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
22 changes: 22 additions & 0 deletions testing/ember-concurrency-v1/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
58 changes: 58 additions & 0 deletions testing/ember-concurrency-v1/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use strict';

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
},
rules: {},
overrides: [
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/*/index.js',
'./server/**/*.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
rules: {
// this can be removed once the following is fixed
// https://github.com/mysticatea/eslint-plugin-node/issues/77
'node/no-unpublished-require': 'off',
},
},
{
// Test files:
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
26 changes: 26 additions & 0 deletions testing/ember-concurrency-v1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
21 changes: 21 additions & 0 deletions testing/ember-concurrency-v1/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 5 additions & 0 deletions testing/ember-concurrency-v1/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
singleQuote: true,
};
5 changes: 5 additions & 0 deletions testing/ember-concurrency-v1/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended',
};
28 changes: 28 additions & 0 deletions testing/ember-concurrency-v1/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
language: node_js
node_js:
- "12"

dist: xenial

addons:
chrome: stable

cache:
yarn: true

env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1

branches:
only:
- master

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

script:
- yarn test
3 changes: 3 additions & 0 deletions testing/ember-concurrency-v1/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
}
57 changes: 57 additions & 0 deletions testing/ember-concurrency-v1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# ember-concurrency-v1-tests

This README outlines the details of collaborating on this Ember application.
A short introduction of this app could easily go here.

## Prerequisites

You will need the following things properly installed on your computer.

* [Git](https://git-scm.com/)
* [Node.js](https://nodejs.org/)
* [Yarn](https://yarnpkg.com/)
* [Ember CLI](https://ember-cli.com/)
* [Google Chrome](https://google.com/chrome/)

## Installation

* `git clone <repository-url>` this repository
* `cd ember-concurrency-v1-tests`
* `yarn install`

## Running / Development

* `ember serve`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

### Code Generators

Make use of the many generators for code, try `ember help generate` for more details

### Running Tests

* `ember test`
* `ember test --server`

### Linting

* `yarn lint`
* `yarn lint:fix`

### Building

* `ember build` (development)
* `ember build --environment production` (production)

### Deploying

Specify what it takes to deploy your app.

## Further Reading / Useful Links

* [ember.js](https://emberjs.com/)
* [ember-cli](https://ember-cli.com/)
* Development Browser Extensions
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
12 changes: 12 additions & 0 deletions testing/ember-concurrency-v1/app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'ember-concurrency-v1-tests/config/environment';

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Resolver = Resolver;
}

loadInitializers(App, config.modulePrefix);
14 changes: 14 additions & 0 deletions testing/ember-concurrency-v1/app/config/environment.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default config;

/**
* Type declarations for
* import config from 'my-app/config/environment'
*/
declare const config: {
environment: string;
modulePrefix: string;
podModulePrefix: string;
locationType: string;
rootURL: string;
APP: Record<string, unknown>;
};
25 changes: 25 additions & 0 deletions testing/ember-concurrency-v1/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>EmberConcurrencyV1Tests</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/ember-concurrency-v1-tests.css">

{{content-for "head-footer"}}
</head>
<body>
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/ember-concurrency-v1-tests.js"></script>

{{content-for "body-footer"}}
</body>
</html>
17 changes: 17 additions & 0 deletions testing/ember-concurrency-v1/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { dropTask } from 'ember-concurrency-decorators';
import Service from '@ember/service';
import { taskFor } from 'ember-concurrency-ts';
import { tracked } from '@glimmer/tracking';
import { useTask } from 'ember-resources';

export default class extends Service {
@tracked foodId = 'pizza';

foodResource = useTask(this, taskFor(this.loadFood), () => [this.foodId]);

@dropTask
async loadFood() {
let food = await Promise.resolve();
return food;
}
}
9 changes: 9 additions & 0 deletions testing/ember-concurrency-v1/app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import EmberRouter from '@ember/routing/router';
import config from 'ember-concurrency-v1-tests/config/environment';

export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
}

Router.map(function () {});
7 changes: 7 additions & 0 deletions testing/ember-concurrency-v1/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{page-title "EmberConcurrencyV1Tests"}}

{{!-- The following component displays Ember's default welcome message. --}}
<WelcomePage />
{{!-- Feel free to remove this! --}}

{{outlet}}
Loading

0 comments on commit 680df8d

Please sign in to comment.