microsoft / microsoft/pxt-arcade

In extension, test files should run after main.ts

Open
#1,817 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension p2
Dominant language
TypeScript
Stars
546
Forks
263
Avg merge
7h 35m
Merged PRs (30d)
46

Description

Describe the bug

There's a handful of things that special case main.ts (I believe the main one in this case is that main.ts is pushed to always be the last thing in the compiled js). When writing extensions that use the scene, test.ts can crash with null pointers when main.ts would not.

edit: in this case it was actually my fault, as I had left code in main.ts rather than moving to a new file; I think that's a pretty common thing to do / the test files should always be moved to the end after main.ts so they're treated like a file using the extension is

To Reproduce
Steps to reproduce the behavior:

  1. load up https://github.com/jwunderl/pxt-status-bar/ at commit 987936a68fd56258f4d2303d0c80ea04e9e63eb8
  2. uncomment test code
  3. See error; the same code works when you press the button test project in new window and use the same tests

Expected behavior

should not break.

not a big problem for development as I can just do the two window approach, but it does make the the gh pages break

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from the pxt-status-bar commit 987936a68fd56258f4d2303d0c80ea04e9e63eb8 by uncommenting the test code. Start by tracing how main.ts and test.ts are ordered in the compiled JavaScript for extensions, then compare that with the two-window test project. Done means extension test files run after main.ts without the null-pointer failure and the GitHub Pages build works.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.