Skip to content

WIP: adding some basic documentation#10

Draft
mansona wants to merge 2 commits intoembroider-build:mainfrom
mansona:basic-docs
Draft

WIP: adding some basic documentation#10
mansona wants to merge 2 commits intoembroider-build:mainfrom
mansona:basic-docs

Conversation

@mansona
Copy link
Copy Markdown
Member

@mansona mansona commented May 29, 2023

I started to try to use scenario-tester for ember-cli-fastboot over the weekend and thought I would start documenting my progress 👍 This is very rough but I thought I would open a WIP just to show that I was working on this

Copy link
Copy Markdown

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Excellent to have something written here!

Comment thread README.md
mkdir test-packages/test-scenarios
```

Next you need to create some scenarios. The best way to create a scenario is from a Project, and the best way to create a project is to have a base project on disk. For example, in EmberJS you can create a new project with `ember new base-project` and it will create a new empty project for you. We can use this as a starting point for our other scenarios.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want --skip-npm and --skip-git flags on that ember command

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that when I personally ran the command but I didn't want to make this all about ember 🤔 there is nothing tying scenario-tester to ember and I thought that was an extra detail that we shouldn't include here. Does that make sense?

I don't feel all that strongly about this so if you (or anyone) does I'm happy to add them 👍

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does make sense, but as is, the example instruction of ember new base-project is misleading / wrong, which is where I'm coming from.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the purpose of having a less frustrating experience and a working set of commands I would add them
OR provide a command to achieve the same without using the ember-cli

Comment thread README.md
import { Scenarios } from 'scenario-tester';
import qunit from 'qunit';

const { module: Qmodule, test } = qunit;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we alias these?
I don't think we need to in ESM?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in a real ESM setup you absolutely do because qunit isn't ESM 😞 In typescript we have been getting away with it for a while because it's so loosey-goosey with the whole thing 🤪

I've been testing this in #11 and ember-fastboot/ember-cli-fastboot#919 and it doesn't work any other way 👍

Copy link
Copy Markdown

@NullVoxPopuli NullVoxPopuli May 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in a real ESM setup you absolutely do because qunit isn't ESM

can you expand on this? I've been using module with qunit in a real ESM environment (vite) no problem.

I maybe thought that this was a browser vs node issue, but even in node, seems like it should be fine:
image

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NullVoxPopuli vite papers over a lot of incompatibilities for you so not sure if it's a good base to go off of

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sorry I thought you were talking about something else 🤔 I thought you were just telling me to do this:

import { module as Qmodule, test } from 'qunit';

and that's what I was saying just doesn't work.

I didn't realise you were commenting on the fact that I was renaming module 🙃 The reason I did this is because I copy and pasted from... either ember-auto-import or embroider... I can't remember.

I never questioned it, but if it's not an issue I am happy to just use module directly 🤷 I assume Ed probably used it because there were a billion and a half uses of the word module in the codebase and it is easier to follow 😂

Comment thread README.md
The power in this kind of setup comes when you start adding in different dependencies that you might want to test this app with. We'll go into that a bit more in the next section. For now to run these tests we can run the following command.

```bash
npx qunit *-test.js
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would favour package.json scripts even though npx may function
as I've seen funny things with npx in a pnpm project where npx ember failed to run spectacularly but npm script of the exact same was just fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants