Skip to content

"Test Scenarios" results in error after scaffold generator is run #1606

@thedavidprice

Description

@thedavidprice

related to PR #1465

Reproduce Error

Running through integration tests in preparation for v0.22 release:

  • clean install
  • upgraded to canary
  • add Posts model to schema.prisma
...
model Post {
  id        Int      @id @default(autoincrement())
  title     String
  body      String
  createdAt DateTime @default(now())
}
...
  • run scaffold generator yarn rw g scaffold post
  • yarn rw dev results in this API error in the console (and I can no longer access localhost:8910/posts):
api | Function "graphql" was not found.
api | POST /graphql 404 0.456 ms - 33
api | 
api | ReferenceError: defineScenario is not defined
api | 
api | at /Users/price/Repos/xx-delete/api/src/services/posts/posts.scenarios.js(anonymous):1
api | 1  
api | 2  export const standard = defineScenario({
api | 3    post: {
api | 4      one: { title: 'String', body: 'String' },
api | 5      two: { title: 'String', body: 'String' },
api | 6    },
api | 7  })
api | 
api | 1 Module._compile
api |   /Users/price/Repos/xx-delete/node_modules/pirates/lib/index.js:99
api | 
api | 2 Object.newLoader [as .js]
api |   /Users/price/Repos/xx-delete/node_modules/pirates/lib/index.js:104
api | 
api | 3 anonymous
api |   /Users/price/Repos/xx-delete/api/src/functions/graphql.js:19

Diagnosis

If I delete the file api/src/services/posts/posts.scenarios.js everything works accordingly. So I hereby blame scenarios ¯_(ツ)_/¯

Metadata

Metadata

Assignees

Labels

bug/confirmedWe have confirmed this is a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions